diff --git a/Cantera/src/GeneralSpeciesThermo.cpp b/Cantera/src/GeneralSpeciesThermo.cpp index bb576392f..98cd03ed6 100644 --- a/Cantera/src/GeneralSpeciesThermo.cpp +++ b/Cantera/src/GeneralSpeciesThermo.cpp @@ -188,6 +188,19 @@ namespace Cantera { } } + //! Modify parameters for the standard state + /*! + * @param index Species index + * @param c Vector of coefficients used to set the + * parameters for the standard state. + */ + void GeneralSpeciesThermo:: + modifyParams(int index, doublereal *c) { + SpeciesThermoInterpType *sp = m_sp[index]; + sp->modifyParameters(c); + } + + /** * Return the lowest temperature at which the thermodynamic * parameterization is valid. If no argument is supplied, the diff --git a/Cantera/src/GeneralSpeciesThermo.h b/Cantera/src/GeneralSpeciesThermo.h index 62c8a65cc..f2ce3edb4 100644 --- a/Cantera/src/GeneralSpeciesThermo.h +++ b/Cantera/src/GeneralSpeciesThermo.h @@ -91,7 +91,14 @@ namespace Cantera { doublereal &maxTemp, doublereal &refPressure) const; - protected: + //! Modify parameters for the standard state + /*! + * @param index Species index + * @param c Vector of coefficients used to set the + * parameters for the standard state. + */ + virtual void modifyParams(int index, doublereal *c); + protected: /** * This is the main unknown in the object. It is diff --git a/Cantera/src/NasaPoly1.h b/Cantera/src/NasaPoly1.h index 110c0d5c8..cd8e78027 100755 --- a/Cantera/src/NasaPoly1.h +++ b/Cantera/src/NasaPoly1.h @@ -54,7 +54,7 @@ namespace Cantera { m_Pref(0.0), m_index (0), m_coeff(array_fp(7)) {} - //! full constructor + //! constructor used in templated instantiations /*! * @param n Species index * @param tlow Minimum temperature diff --git a/Cantera/src/NasaThermo.h b/Cantera/src/NasaThermo.h index d768f930e..093e6f8e8 100755 --- a/Cantera/src/NasaThermo.h +++ b/Cantera/src/NasaThermo.h @@ -265,7 +265,7 @@ namespace Cantera { * supplied, then the value returned is the maximum * temperature for parameterization k. * - * @param k index for parameterization k + * @param k Species index */ virtual doublereal maxTemp(int k=-1) const { if (k < 0) @@ -285,7 +285,7 @@ namespace Cantera { * as those for ideal gases, require that all species * in the same phase have the same reference state pressures. * - * @param k index for parameterization k + * @param k Species index */ virtual doublereal refPressure(int k = -1) const { return m_p0; @@ -417,12 +417,12 @@ namespace Cantera { */ vector_fp m_tmid; - //! Maximum value of the low temperature limit - + //! Maximum value of the low temperature limit doublereal m_tlow_max; //! Minimum value of the high temperature limit doublereal m_thigh_min; + //! Vector of low temperature limits (species index) /*! * Length is equal to number of species diff --git a/Cantera/src/ShomatePoly.h b/Cantera/src/ShomatePoly.h index 10cd82b6c..49c16ca27 100755 --- a/Cantera/src/ShomatePoly.h +++ b/Cantera/src/ShomatePoly.h @@ -1,6 +1,8 @@ /** * @file ShomatePoly.h * + * Shomate polynomial expressions. + * * $Author$ * $Revision$ * $Date$ @@ -16,321 +18,572 @@ namespace Cantera { - /** - * The Shomate polynomial parameterization for one temperature range. - * Seven coefficients \f$(a_0,\dots,a_6)\f$ are used to represent - * \f$ c_p^0(T)\f$, \f$ h^0(T)\f$, and \f$ s^0(T) \f$ as - * polynomials in \f$ T \f$ : - * \f[ - * \hat c_p(T) = A + B t + C t^2 + D t^3 + \frac{E}{t^2} - * \f] - * \f[ - * \hat h^0(T) = A t + \frac{B t^2}{2} + \frac{C t^3}{3} - + \frac{D t^4}{4} - \frac{E}{t} + F. - * \f] - * \f[ - * s^0(T) = A\ln t + B t + \frac{C t^2}{2} - + \frac{D t^3}{3} - \frac{E}{2t^2} + G. - * \f] + + //! The Shomate polynomial parameterization for one temperature range + //! for one species + /*! + * + * Seven coefficients \f$(A,\dots,G)\f$ are used to represent + * \f$ c_p^0(T)\f$, \f$ h^0(T)\f$, and \f$ s^0(T) \f$ as + * polynomials in the temperature, \f$ T \f$ : + * + * \f[ + * \tilde{c}_p^0(T) = A + B t + C t^2 + D t^3 + \frac{E}{t^2} + * \f] + * \f[ + * \tilde{h}^0(T) = A t + \frac{B t^2}{2} + \frac{C t^3}{3} + + \frac{D t^4}{4} - \frac{E}{t} + F. + * \f] + * \f[ + * \tilde{s}^0(T) = A\ln t + B t + \frac{C t^2}{2} + + \frac{D t^3}{3} - \frac{E}{2t^2} + G. + * \f] + * + * In the above expressions, the thermodynamic polynomials are expressed + * in dimensional units, but the temperature,\f$ t \f$, is divided by 1000. The + * following dimensions are assumed in the above expressions: + * + * - \f$ \tilde{c}_p^0(T)\f$ = Heat Capacity (J/gmol*K) + * - \f$ \tilde{h}^0(T) \f$ = standard Enthalpy (kJ/gmol) + * - \f$ \tilde{s}^0(T) \f$= standard Entropy (J/gmol*K) + * - \f$ t \f$= temperature (K) / 1000. + * + * For more information about Shomate polynomials, see the NIST website, + * http://webbook.nist.gov/ + * + * Before being used within Cantera, the dimensions must be adjusted to those + * used by Cantera (i.e., Joules and kmol). + * + + * @ingroup spthermo + */ + class ShomatePoly : public SpeciesThermoInterpType { + + public: + + //! Empty constructor + ShomatePoly() + : m_lowT(0.0), m_highT (0.0), + m_Pref(0.0), m_index (0) {} + + //! Constructor used in templated instantiations + /*! + * @param n Species index + * @param tlow Minimum temperature + * @param thigh Maximum temperature + * @param pref reference pressure (Pa). + * @param coeffs Vector of coefficients used to set the + * parameters for the standard state for species n. + * There are 7 coefficients for the Shomate polynomial: + * - c[0] = \f$ A \f$ + * - c[1] = \f$ B \f$ + * - c[2] = \f$ C \f$ + * - c[3] = \f$ D \f$ + * - c[4] = \f$ E \f$ + * - c[5] = \f$ F \f$ + * - c[6] = \f$ G \f$ + * + * See the class description for the polynomial representation of the + * thermo functions in terms of \f$ A, \dots, G \f$. */ + ShomatePoly(int n, doublereal tlow, doublereal thigh, doublereal pref, + const doublereal* coeffs) : + m_lowT (tlow), + m_highT (thigh), + m_Pref (pref), + m_index (n) { + m_coeff.resize(7); + std::copy(coeffs, coeffs + 7, m_coeff.begin()); + } - class ShomatePoly : public SpeciesThermoInterpType { + //! copy constructor + /*! + * @param b object to be copied + */ + ShomatePoly(const ShomatePoly& b) : + m_lowT (b.m_lowT), + m_highT (b.m_highT), + m_Pref (b.m_Pref), + m_coeff (array_fp(7)), + m_index (b.m_index) { + std::copy(b.m_coeff.begin(), + b.m_coeff.begin() + 7, + m_coeff.begin()); + } - public: - - ShomatePoly() - : m_lowT(0.0), m_highT (0.0), - m_Pref(0.0), m_index (0) {m_coeff.resize(7);} - - ShomatePoly(int n, doublereal tlow, doublereal thigh, doublereal pref, - const doublereal* coeffs) : - m_lowT (tlow), - m_highT (thigh), - m_Pref (pref), - m_index (n) { - m_coeff.resize(7); - std::copy(coeffs, coeffs + 7, m_coeff.begin()); - } - - ShomatePoly(const ShomatePoly& b) : - m_lowT (b.m_lowT), - m_highT (b.m_highT), - m_Pref (b.m_Pref), - m_coeff (array_fp(7)), - m_index (b.m_index) { - std::copy(b.m_coeff.begin(), - b.m_coeff.begin() + 7, - m_coeff.begin()); - } - - ShomatePoly& operator=(const ShomatePoly& b) { - if (&b != this) { - m_lowT = b.m_lowT; - m_highT = b.m_highT; - m_Pref = b.m_Pref; - m_index = b.m_index; - std::copy(b.m_coeff.begin(), - b.m_coeff.begin() + 7, - m_coeff.begin()); - } - return *this; - } - virtual ~ShomatePoly(){} - - virtual SpeciesThermoInterpType * - duplMyselfAsSpeciesThermoInterpType() const { - ShomatePoly* sp = new ShomatePoly(*this); - return (SpeciesThermoInterpType *) sp; - } - - doublereal minTemp() const { return m_lowT;} - doublereal maxTemp() const { return m_highT;} - doublereal refPressure() const { return m_Pref; } - virtual int reportType() const { return SHOMATE; } - - /** - * This formulation calculates the thermo functions - * given the native formulation of the temperature - * polynomial - * - * tt is T/1000. - * m_t[0] = tt; - * m_t[1] = tt*tt; - * m_t[2] = m_t[1]*tt; - * m_t[3] = 1.0/m_t[1]; - * m_t[4] = log(tt); - * m_t[5] = 1.0/GasConstant; - * m_t[6] = 1.0/(GasConstant * T); - */ - void updateProperties(const doublereal* tt, - doublereal* cp_R, doublereal* h_RT, - doublereal* s_R) const { - - doublereal A = m_coeff[0]; - doublereal Bt = m_coeff[1]*tt[0]; - doublereal Ct2 = m_coeff[2]*tt[1]; - doublereal Dt3 = m_coeff[3]*tt[2]; - doublereal Etm2 = m_coeff[4]*tt[3]; - doublereal F = m_coeff[5]; - doublereal G = m_coeff[6]; - - doublereal cp, h, s; - cp = A + Bt + Ct2 + Dt3 + Etm2; - h = tt[0]*(A + 0.5*Bt + OneThird*Ct2 + 0.25*Dt3 - Etm2) + F; - s = A*tt[4] + Bt + 0.5*Ct2 + OneThird*Dt3 - 0.5*Etm2 + G; - - /* - * Shomate polynomials parameterizes assuming units of - * J/(gmol*K) for cp_r and s_R and kJ/(gmol) for h. - * However, Cantera assumes default MKS units of - * J/(kmol*K). This requires us to multiply cp and s - * by 1.e3 and h by 1.e6, before we then nondimensionlize - * the results by dividing by (GasConstant * T), - * where GasConstant has units of J/(kmol * K). - */ - cp_R[m_index] = 1.e3 * cp * tt[5]; - h_RT[m_index] = 1.e6 * h * tt[6]; - s_R[m_index] = 1.e3 * s * tt[5]; - } - - /** - * updatePropertiesTemp(): - * This formulation creates its own temperature - * polynomial. Then, it calls updateProperties(); - * -> general, but slow. - */ - void updatePropertiesTemp(const doublereal temp, - doublereal* cp_R, doublereal* h_RT, - doublereal* s_R) const { - double tPoly[7]; - doublereal tt = 1.e-3*temp; - tPoly[0] = tt; - tPoly[1] = tt * tt; - tPoly[2] = tPoly[1] * tt; - tPoly[3] = 1.0/tPoly[1]; - tPoly[4] = std::log(tt); - tPoly[5] = 1.0/GasConstant; - tPoly[6] = 1.0/(GasConstant * temp); - updateProperties(tPoly, cp_R, h_RT, s_R); - } - - - void reportParameters(int &n, int &type, - doublereal &tlow, doublereal &thigh, - doublereal &pref, - doublereal* const coeffs) const { - n = m_index; - type = SHOMATE; - tlow = m_lowT; - thigh = m_highT; - pref = m_Pref; - for (int i = 0; i < 7; i++) { - coeffs[i] = m_coeff[i]; - } - } - protected: - - doublereal m_lowT, m_highT, m_Pref; - array_fp m_coeff; - int m_index; + //! Assignment operator + /*! + * @param b + */ + ShomatePoly& operator=(const ShomatePoly& b) { + if (&b != this) { + m_lowT = b.m_lowT; + m_highT = b.m_highT; + m_Pref = b.m_Pref; + m_index = b.m_index; + m_coeff.resize(7); + std::copy(b.m_coeff.begin(), + b.m_coeff.begin() + 7, + m_coeff.begin()); + } + return *this; + } - private: + //! Destructor + virtual ~ShomatePoly(){} - }; + //! Duplicator from the base class + virtual SpeciesThermoInterpType * + duplMyselfAsSpeciesThermoInterpType() const { + ShomatePoly* sp = new ShomatePoly(*this); + return (SpeciesThermoInterpType *) sp; + } + //! Returns the minimum temperature that the thermo + //! parameterization is valid + virtual doublereal minTemp() const { return m_lowT;} + //! Returns the maximum temperature that the thermo + //! parameterization is valid + virtual doublereal maxTemp() const { return m_highT;} - class ShomatePoly2 : public SpeciesThermoInterpType { - public: + //! Returns the reference pressure (Pa) + virtual doublereal refPressure() const { return m_Pref; } - ShomatePoly2() - : m_lowT(0.0), - m_midT(0.0), - m_highT (0.0), - m_Pref(0.0), - msp_low(0), - msp_high(0), - m_index(0) { - m_coeff.resize(15); - } + //! Returns an integer representing the type of parameterization + virtual int reportType() const { return SHOMATE; } + + + //! Update the properties for this species, given a temperature polynomial + /*! + * This method is called with a pointer to an array containing the functions of + * temperature needed by this parameterization, and three pointers to arrays where the + * computed property values should be written. This method updates only one value in + * each array. + * + * tt is T/1000. + * m_t[0] = tt; + * m_t[1] = tt*tt; + * m_t[2] = m_t[1]*tt; + * m_t[3] = 1.0/m_t[1]; + * m_t[4] = log(tt); + * m_t[5] = 1.0/GasConstant; + * m_t[6] = 1.0/(GasConstant * T); + * + * @param tt Vector of temperature polynomials + * @param cp_R Vector of Dimensionless heat capacities. + * (length m_kk). + * @param h_RT Vector of Dimensionless enthalpies. + * (length m_kk). + * @param s_R Vector of Dimensionless entropies. + * (length m_kk). + */ + virtual void updateProperties(const doublereal* tt, + doublereal* cp_R, doublereal* h_RT, + doublereal* s_R) const { - ShomatePoly2(int n, doublereal tlow, doublereal thigh, doublereal pref, - const doublereal* coeffs) : - m_lowT (tlow), - m_midT(0.0), - m_highT (thigh), - m_Pref (pref), - msp_low(0), - msp_high(0), - m_index (n) { - m_coeff.resize(15); - std::copy(coeffs, coeffs + 15, m_coeff.begin()); - m_midT = coeffs[0]; - msp_low = new ShomatePoly(n, tlow, m_midT, pref, coeffs+1); - msp_high = new ShomatePoly(n, m_midT, thigh, pref, coeffs+8); - } + doublereal A = m_coeff[0]; + doublereal Bt = m_coeff[1]*tt[0]; + doublereal Ct2 = m_coeff[2]*tt[1]; + doublereal Dt3 = m_coeff[3]*tt[2]; + doublereal Etm2 = m_coeff[4]*tt[3]; + doublereal F = m_coeff[5]; + doublereal G = m_coeff[6]; - ShomatePoly2(const ShomatePoly2& b) : - m_lowT (b.m_lowT), - m_midT (b.m_midT), - m_highT (b.m_highT), - m_Pref (b.m_Pref), - msp_low(0), - msp_high(0), - m_coeff (array_fp(15)), - m_index (b.m_index) { - std::copy(b.m_coeff.begin(), - b.m_coeff.begin() + 15, - m_coeff.begin()); - msp_low = new ShomatePoly(m_index, m_lowT, m_midT, - m_Pref, &m_coeff[1]); - msp_high = new ShomatePoly(m_index, m_midT, m_highT, - m_Pref, &m_coeff[8]); - } + doublereal cp, h, s; + cp = A + Bt + Ct2 + Dt3 + Etm2; + h = tt[0]*(A + 0.5*Bt + OneThird*Ct2 + 0.25*Dt3 - Etm2) + F; + s = A*tt[4] + Bt + 0.5*Ct2 + OneThird*Dt3 - 0.5*Etm2 + G; - ShomatePoly2& operator=(const ShomatePoly2& b) { - if (&b != this) { - m_lowT = b.m_lowT; - m_midT = b.m_midT; - m_highT = b.m_highT; - m_Pref = b.m_Pref; - m_index = b.m_index; - std::copy(b.m_coeff.begin(), - b.m_coeff.begin() + 15, - m_coeff.begin()); - if (msp_low) delete msp_low; - if (msp_high) delete msp_high; - msp_low = new ShomatePoly(m_index, m_lowT, m_midT, - m_Pref, &m_coeff[1]); - msp_high = new ShomatePoly(m_index, m_midT, m_highT, - m_Pref, &m_coeff[8]); - } - return *this; - } + /* + * Shomate polynomials parameterizes assuming units of + * J/(gmol*K) for cp_r and s_R and kJ/(gmol) for h. + * However, Cantera assumes default MKS units of + * J/(kmol*K). This requires us to multiply cp and s + * by 1.e3 and h by 1.e6, before we then nondimensionlize + * the results by dividing by (GasConstant * T), + * where GasConstant has units of J/(kmol * K). + */ + cp_R[m_index] = 1.e3 * cp * tt[5]; + h_RT[m_index] = 1.e6 * h * tt[6]; + s_R[m_index] = 1.e3 * s * tt[5]; + } - virtual ~ShomatePoly2(){ - delete msp_low; - delete msp_high; - } - - virtual SpeciesThermoInterpType * - duplMyselfAsSpeciesThermoInterpType() const { - ShomatePoly2* sp = new ShomatePoly2(*this); - return (SpeciesThermoInterpType *) sp; - } - - doublereal minTemp() const { return m_lowT;} - doublereal maxTemp() const { return m_highT;} - doublereal refPressure() const { return m_Pref; } - virtual int reportType() const { return SHOMATE2; } - - /** - * This formulation calculates the thermo functions - * given the native formulation of the temperature - * polynomial - * - * tt is T/1000. - * m_t[0] = tt; - * m_t[1] = tt*tt; - * m_t[2] = m_t[1]*tt; - * m_t[3] = 1.0/m_t[1]; - * m_t[4] = std::log(tt); - * m_t[5] = 1.0/GasConstant; - * m_t[6] = 1.0/(GasConstant * T); - */ - void updateProperties(const doublereal* tt, + //! Compute the reference-state property of one species + /*! + * Given temperature T in K, this method updates the values of + * the non-dimensional heat capacity at constant pressure, + * enthalpy, and entropy, at the reference pressure, Pref + * of one of the species. The species index is used + * to reference into the cp_R, h_RT, and s_R arrays. + * + * @param temp Temperature (Kelvin) + * @param cp_R Vector of Dimensionless heat capacities. + * (length m_kk). + * @param h_RT Vector of Dimensionless enthalpies. + * (length m_kk). + * @param s_R Vector of Dimensionless entropies. + * (length m_kk). + */ + virtual void updatePropertiesTemp(const doublereal temp, doublereal* cp_R, doublereal* h_RT, doublereal* s_R) const { - double T = 1000 * tt[0]; - if (T <= m_midT) { - msp_low->updateProperties(tt, cp_R, h_RT, s_R); - } else { - msp_high->updateProperties(tt, cp_R, h_RT, s_R); - } + double tPoly[7]; + doublereal tt = 1.e-3*temp; + tPoly[0] = tt; + tPoly[1] = tt * tt; + tPoly[2] = tPoly[1] * tt; + tPoly[3] = 1.0/tPoly[1]; + tPoly[4] = std::log(tt); + tPoly[5] = 1.0/GasConstant; + tPoly[6] = 1.0/(GasConstant * temp); + updateProperties(tPoly, cp_R, h_RT, s_R); + } + + //!This utility function reports back the type of + //! parameterization and all of the parameters for the + //! species, index. + /*! + * All parameters are output variables + * + * @param n Species index + * @param type Integer type of the standard type + * @param tlow output - Minimum temperature + * @param thigh output - Maximum temperature + * @param pref output - reference pressure (Pa). + * @param coeffs Vector of coefficients used to set the + * parameters for the standard state. + */ + virtual void reportParameters(int &n, int &type, + doublereal &tlow, doublereal &thigh, + doublereal &pref, + doublereal* const coeffs) const { + n = m_index; + type = SHOMATE; + tlow = m_lowT; + thigh = m_highT; + pref = m_Pref; + for (int i = 0; i < 7; i++) { + coeffs[i] = m_coeff[i]; + } + } + + //! Modify parameters for the standard state + /*! + * @param coeffs Vector of coefficients used to set the + * parameters for the standard state. + */ + virtual void modifyParameters(doublereal* coeffs) { + if (m_coeff.size() != 7) { + throw CanteraError("modifyParameters", + "modifying something that hasn't been initialized"); + } + std::copy(coeffs, coeffs + 7, m_coeff.begin()); + } + + protected: + //! Minimum temperature for which the parameterization is valid (Kelvin) + doublereal m_lowT; + //! Maximum temperature for which the parameterization is valid (Kelvin) + doublereal m_highT; + //! Reference pressure (Pa) + doublereal m_Pref; + //! Array of coeffcients + array_fp m_coeff; + //! Species Index + int m_index; + + private: + + }; + + //! The Shomate polynomial parameterization for two temperature ranges + //! for one species + /*! + * + * Seven coefficients \f$(A,\dots,G)\f$ are used to represent + * \f$ c_p^0(T)\f$, \f$ h^0(T)\f$, and \f$ s^0(T) \f$ as + * polynomials in the temperature, \f$ T \f$, in one temperature region: + * + * \f[ + * \tilde{c}_p^0(T) = A + B t + C t^2 + D t^3 + \frac{E}{t^2} + * \f] + * \f[ + * \tilde{h}^0(T) = A t + \frac{B t^2}{2} + \frac{C t^3}{3} + + \frac{D t^4}{4} - \frac{E}{t} + F. + * \f] + * \f[ + * \tilde{s}^0(T) = A\ln t + B t + \frac{C t^2}{2} + + \frac{D t^3}{3} - \frac{E}{2t^2} + G. + * \f] + * + * In the above expressions, the thermodynamic polynomials are expressed + * in dimensional units, but the temperature,\f$ t \f$, is divided by 1000. The + * following dimensions are assumed in the above expressions: + * + * - \f$ \tilde{c}_p^0(T)\f$ = Heat Capacity (J/gmol*K) + * - \f$ \tilde{h}^0(T) \f$ = standard Enthalpy (kJ/gmol) + * - \f$ \tilde{s}^0(T) \f$= standard Entropy (J/gmol*K) + * - \f$ t \f$= temperature (K) / 1000. + * + * For more information about Shomate polynomials, see the NIST website, + * http://webbook.nist.gov/ + * + * Before being used within Cantera, the dimensions must be adjusted to those + * used by Cantera (i.e., Joules and kmol). + * + * This function uses two temperature regions, each with a Shomate polynomial + * representation to represent the thermo functions. There are 15 coefficients, + * therefore, in this representation. The first coefficient is the midrange + * temperature. + * + * + * @ingroup spthermo + */ + class ShomatePoly2 : public SpeciesThermoInterpType { + public: + + //! Empty constructor + ShomatePoly2() + : m_lowT(0.0), + m_midT(0.0), + m_highT (0.0), + m_Pref(0.0), + msp_low(0), + msp_high(0), + m_index(0) { + m_coeff.resize(15); + } + + //! Constructor used in templated instantiations + /*! + * @param n Species index + * @param tlow Minimum temperature + * @param thigh Maximum temperature + * @param pref reference pressure (Pa). + * @param coeffs Vector of coefficients used to set the + * parameters for the standard state. + * There are 15 coefficients for the 2-zone Shomate polynomial. + * The first coefficient is the value of Tmid. The next 7 + * coefficients are the low temperature range Shomate coefficients. + * The last 7 are the high temperature range Shomate coefficients. + */ + ShomatePoly2(int n, doublereal tlow, doublereal thigh, doublereal pref, + const doublereal* coeffs) : + m_lowT (tlow), + m_midT(0.0), + m_highT (thigh), + m_Pref (pref), + msp_low(0), + msp_high(0), + m_index (n) { + m_coeff.resize(15); + std::copy(coeffs, coeffs + 15, m_coeff.begin()); + m_midT = coeffs[0]; + msp_low = new ShomatePoly(n, tlow, m_midT, pref, coeffs+1); + msp_high = new ShomatePoly(n, m_midT, thigh, pref, coeffs+8); + } + + //! Copy constructor + /*! + * @param b object to be copied. + */ + ShomatePoly2(const ShomatePoly2& b) : + m_lowT (b.m_lowT), + m_midT (b.m_midT), + m_highT (b.m_highT), + m_Pref (b.m_Pref), + msp_low(0), + msp_high(0), + m_coeff (array_fp(15)), + m_index (b.m_index) { + std::copy(b.m_coeff.begin(), + b.m_coeff.begin() + 15, + m_coeff.begin()); + msp_low = new ShomatePoly(m_index, m_lowT, m_midT, + m_Pref, &m_coeff[1]); + msp_high = new ShomatePoly(m_index, m_midT, m_highT, + m_Pref, &m_coeff[8]); + } + + //! Assignment operator + /*! + * @param b object to be copied. + */ + ShomatePoly2& operator=(const ShomatePoly2& b) { + if (&b != this) { + m_lowT = b.m_lowT; + m_midT = b.m_midT; + m_highT = b.m_highT; + m_Pref = b.m_Pref; + m_index = b.m_index; + std::copy(b.m_coeff.begin(), + b.m_coeff.begin() + 15, + m_coeff.begin()); + if (msp_low) delete msp_low; + if (msp_high) delete msp_high; + msp_low = new ShomatePoly(m_index, m_lowT, m_midT, + m_Pref, &m_coeff[1]); + msp_high = new ShomatePoly(m_index, m_midT, m_highT, + m_Pref, &m_coeff[8]); + } + return *this; + } + + //! Destructor + virtual ~ShomatePoly2(){ + delete msp_low; + delete msp_high; + } + + + //! duplicator + virtual SpeciesThermoInterpType * + duplMyselfAsSpeciesThermoInterpType() const { + ShomatePoly2* sp = new ShomatePoly2(*this); + return (SpeciesThermoInterpType *) sp; + } + + //! Returns the minimum temperature that the thermo + //! parameterization is valid + virtual doublereal minTemp() const { return m_lowT;} + + //! Returns the maximum temperature that the thermo + //! parameterization is valid + virtual doublereal maxTemp() const { return m_highT;} + + //! Returns the reference pressure (Pa) + virtual doublereal refPressure() const { return m_Pref; } + + //! Returns an integer representing the type of parameterization + virtual int reportType() const { return SHOMATE2; } + + + //! Update the properties for this species, given a temperature polynomial + /*! + * This method is called with a pointer to an array containing the functions of + * temperature needed by this parameterization, and three pointers to arrays where the + * computed property values should be written. This method updates only one value in + * each array. + * + * Temperature Polynomial: + * tt[0] = t; + * tt[1] = t*t; + * tt[2] = m_t[1]*t; + * tt[3] = m_t[2]*t; + * tt[4] = 1.0/t; + * tt[5] = std::log(t); + * + * @param tt vector of temperature polynomials + * @param cp_R Vector of Dimensionless heat capacities. + * (length m_kk). + * @param h_RT Vector of Dimensionless enthalpies. + * (length m_kk). + * @param s_R Vector of Dimensionless entropies. + * (length m_kk). + */ + virtual void updateProperties(const doublereal* tt, + doublereal* cp_R, doublereal* h_RT, + doublereal* s_R) const { + double T = 1000 * tt[0]; + if (T <= m_midT) { + msp_low->updateProperties(tt, cp_R, h_RT, s_R); + } else { + msp_high->updateProperties(tt, cp_R, h_RT, s_R); + } - } + } - /** - * updatePropertiesTemp(): - * This formulation creates its own temperature - * polynomial. Then, it calls updateProperties(); - * -> general, but slow. - */ - void updatePropertiesTemp(const doublereal temp, - doublereal* cp_R, - doublereal* h_RT, - doublereal* s_R) const { - if (temp <= m_midT) { - msp_low->updatePropertiesTemp(temp, cp_R, h_RT, s_R); - } else { - msp_high->updatePropertiesTemp(temp, cp_R, h_RT, s_R); - } - } + //! Compute the reference-state property of one species + /*! + * Given temperature T in K, this method updates the values of + * the non-dimensional heat capacity at constant pressure, + * enthalpy, and entropy, at the reference pressure, Pref + * of one of the species. The species index is used + * to reference into the cp_R, h_RT, and s_R arrays. + * + * @param temp Temperature (Kelvin) + * @param cp_R Vector of Dimensionless heat capacities. + * (length m_kk). + * @param h_RT Vector of Dimensionless enthalpies. + * (length m_kk). + * @param s_R Vector of Dimensionless entropies. + * (length m_kk). + */ + virtual void updatePropertiesTemp(const doublereal temp, + doublereal* cp_R, + doublereal* h_RT, + doublereal* s_R) const { + if (temp <= m_midT) { + msp_low->updatePropertiesTemp(temp, cp_R, h_RT, s_R); + } else { + msp_high->updatePropertiesTemp(temp, cp_R, h_RT, s_R); + } + } - void reportParameters(int &n, int &type, - doublereal &tlow, doublereal &thigh, - doublereal &pref, - doublereal* const coeffs) const { - n = m_index; - type = SHOMATE2; - tlow = m_lowT; - thigh = m_highT; - pref = m_Pref; - for (int i = 0; i < 15; i++) { - coeffs[i] = m_coeff[i]; - } - } + //!This utility function reports back the type of + //! parameterization and all of the parameters for the + //! species, index. + /*! + * All parameters are output variables + * + * @param n Species index + * @param type Integer type of the standard type + * @param tlow output - Minimum temperature + * @param thigh output - Maximum temperature + * @param pref output - reference pressure (Pa). + * @param coeffs Vector of coefficients used to set the + * parameters for the standard state. + */ + virtual void reportParameters(int &n, int &type, + doublereal &tlow, doublereal &thigh, + doublereal &pref, + doublereal* const coeffs) const { + n = m_index; + type = SHOMATE2; + tlow = m_lowT; + thigh = m_highT; + pref = m_Pref; + for (int i = 0; i < 15; i++) { + coeffs[i] = m_coeff[i]; + } + } - protected: - - doublereal m_lowT, m_midT; - doublereal m_highT; - doublereal m_Pref; - ShomatePoly *msp_low; - ShomatePoly *msp_high; - array_fp m_coeff; - int m_index; - }; + //! Modify parameters for the standard state + /*! + * Here, we take the tact that we will just regenerate the + * object. + * + * @param coeffs Vector of coefficients used to set the + * parameters for the standard state. + */ + virtual void modifyParameters(doublereal* coeffs) { + delete msp_low; + delete msp_high; + std::copy(coeffs, coeffs + 15, m_coeff.begin()); + m_midT = coeffs[0]; + msp_low = new ShomatePoly(m_index, m_lowT, m_midT, m_Pref, coeffs+1); + msp_high = new ShomatePoly(m_index, m_midT, m_highT, m_Pref, coeffs+8); + } + + protected: + //! Minimum temperature the representation is valid(kelvin) + doublereal m_lowT; + //! Midrange temperature (kelvin) + doublereal m_midT; + //! Maximum temperature the representation is valid (kelvin) + doublereal m_highT; + //! Reference pressure (Pascal) + doublereal m_Pref; + //! Pointer to the Shomate polynomial for the low temperature region. + ShomatePoly *msp_low; + //! Pointer to the Shomate polynomial for the high temperature region. + ShomatePoly *msp_high; + //! Array of the original coefficients. + array_fp m_coeff; + //! Species index + int m_index; + }; } #endif diff --git a/Cantera/src/ShomateThermo.h b/Cantera/src/ShomateThermo.h index aeb56aa7d..811799edd 100755 --- a/Cantera/src/ShomateThermo.h +++ b/Cantera/src/ShomateThermo.h @@ -1,31 +1,15 @@ /** * @file ShomateThermo.h * - * This parameterization requires 7 coefficients A - G: - * - * \f[ C_p = A + B*t + C*t2 + D*t3 + E/t^2 \f] - * - * \f[ H - H_298.15= A*t + B*t^2/2 + C*t^3/3 + D*t^4/4 - E/t + F - * - \Delta_f H_{f,298} \f] - * - * \f[ S = A*ln(t) + B*t + C*t^2/2 + D*t^3/3 - E/(2*t^2) + G \f] - * - * - Cp = heat capacity (J/gmol*K) - * - H = standard enthalpy (kJ/gmol) - * - \f$ \Delta_f H_298.15 \f$ = enthalpy of formation at 298.15 K (kJ/gmol) - * - S = standard entropy (J/gmol*K) - * - t = temperature (K) / 1000. - * - * Note, the polynomial data (i.e., A, ... , G) is entered in dimensional form. - * This is in contrast to the NASA database polynomials which are entered in - * nondimensional form (i.e., NASA parameterizes C_p/R, while Shomate - * parameterizes C_p assuming units of J/gmol*K - and kJ/gmol*K for H). - * Note, also that the H - H_298.15 equation has units of kJ/gmol, because of - * the implicit integration of (t = T 1000), which provides a - * multiplier of 1000 to the Enthalpy equation. + * Definitions and declarations for a species property manager that + * uses the Shomate polynomials. * + * $Id$ */ +// Copyright 2001 California Institute of Technology + + #ifndef CT_SHOMATETHERMO_H #define CT_SHOMATETHERMO_H @@ -35,221 +19,446 @@ namespace Cantera { - /** - * A species thermodynamic property manager for the Shomate - * polynomial parameterization. This is the parameterization used - * in the NIST Chemistry WebBook (http://webbook.nist.gov/chemistry) - */ - class ShomateThermo : public SpeciesThermo { + /*! + * A species thermodynamic property manager for the Shomate + * polynomial parameterization. This is the parameterization used + * in the NIST Chemistry WebBook (http://webbook.nist.gov/chemistry) + * + * This parameterization assumes there are two temperature regions + * each with its own Shomate polynomial representation, for each + * species in the phase. + * + * \f[ + * \tilde{c}_p^0(T) = A + B t + C t^2 + D t^3 + \frac{E}{t^2} + * \f] + * \f[ + * \tilde{h}^0(T) = A t + \frac{B t^2}{2} + \frac{C t^3}{3} + + \frac{D t^4}{4} - \frac{E}{t} + F. + * \f] + * \f[ + * \tilde{s}^0(T) = A\ln t + B t + \frac{C t^2}{2} + + \frac{D t^3}{3} - \frac{E}{2t^2} + G. + * \f] + * + * In the above expressions, the thermodynamic polynomials are expressed + * in dimensional units, but the temperature,\f$ t \f$, is divided by 1000. The + * following dimensions are assumed in the above expressions: + * + * - \f$ \tilde{c}_p^0(T)\f$ = Heat Capacity (J/gmol*K) + * - \f$ \tilde{h}^0(T) \f$ = standard Enthalpy (kJ/gmol) + * - \f$ \tilde{s}^0(T) \f$= standard Entropy (J/gmol*K) + * - \f$ t \f$= temperature (K) / 1000. + * + * Note, the polynomial data (i.e., A, ... , G) is entered in dimensional + * form. + * + * This is in contrast to the NASA database polynomials which are entered in + * nondimensional form (i.e., NASA parameterizes C_p/R, while Shomate + * parameterizes C_p assuming units of J/gmol*K - and kJ/gmol*K for H). + * Note, also that the H - H_298.15 equation has units of kJ/gmol, because of + * the implicit integration of (t = T 1000), which provides a + * multiplier of 1000 to the Enthalpy equation. + * + * @ingroup spthermo + */ + class ShomateThermo : public SpeciesThermo { - public: + public: - const int ID; - - ShomateThermo() : - ID(SHOMATE), - m_tlow_max(0.0), - m_thigh_min(1.e30), - m_ngroups(0) { m_t.resize(7); } + //! Initialized to the type of parameterization + /*! + * Note, this value is used in some template functions + */ + const int ID; - virtual ~ShomateThermo() {} + //! constructor + ShomateThermo() : + ID(SHOMATE), + m_tlow_max(0.0), + m_thigh_min(1.e30), + m_p0(-1.0), + m_ngroups(0) + { m_t.resize(7); } - /** - * Install values for a new species. - * @param index Species index - * @param type ignored, since only Shomate type is supported - * @param c coefficients. These are parameters A through G - * in the same units as used in the NIST Chemistry WebBook. - * - */ - virtual void install(string name, int index, int type, - const doublereal* c, - doublereal minTemp, doublereal maxTemp, - doublereal refPressure) { - int imid = int(c[0]); // midpoint temp converted to integer - int igrp = m_index[imid]; // has this value been seen before? - if (igrp == 0) { // if not, prepare new group - vector v; - m_high.push_back(v); - m_low.push_back(v); - m_tmid.push_back(c[0]); - m_index[imid] = igrp = static_cast(m_high.size()); - m_ngroups++; - } - m_group_map[index] = igrp; - m_posInGroup_map[index] = (int) m_low[igrp-1].size(); - doublereal tlow = minTemp; - doublereal tmid = c[0]; - doublereal thigh = maxTemp; - doublereal pref = refPressure; - const doublereal* clow = c + 1; - const doublereal* chigh = c + 8; - m_high[igrp-1].push_back(ShomatePoly(index, tmid, thigh, - pref, chigh)); - m_low[igrp-1].push_back(ShomatePoly(index, tlow, tmid, - pref, clow)); - if (tlow > m_tlow_max) m_tlow_max = tlow; - if (thigh < m_thigh_min) m_thigh_min = thigh; - m_tlow.push_back(tlow); - m_thigh.push_back(thigh); - m_p0 = pref; - } + //! destructor + virtual ~ShomateThermo() {} - /** - * update the properties for only one species. - */ - virtual void update_one(int k, doublereal t, doublereal* cp_R, - doublereal* h_RT, doublereal* s_R) const { + //! Install a new species thermodynamic property + //! parameterization for one species using Shomate polynomials + //! + /*! + * Two temperature regions are assumed. + * + * @param name Name of the species + * @param index Species index + * @param type int flag specifying the type of parameterization to be + * installed. + * @param c Vector of coefficients for the parameterization. + * There are 15 coefficients for the 2-zone Shomate polynomial. + * The first coefficient is the value of Tmid. The next 7 + * coefficients are the low temperature range Shomate coefficients. + * The last 7 are the high temperature range Shomate coefficients. + * + * @param minTemp minimum temperature for which this parameterization + * is valid. + * @param maxTemp maximum temperature for which this parameterization + * is valid. + * @param refPressure standard-state pressure for this + * parameterization. + * + * @see ShomatePoly + * @see ShomatePoly2 + */ + virtual void install(string name, int index, int type, + const doublereal* c, + doublereal minTemp, doublereal maxTemp, + doublereal refPressure) { + int imid = int(c[0]); // midpoint temp converted to integer + int igrp = m_index[imid]; // has this value been seen before? + if (igrp == 0) { // if not, prepare new group + vector v; + m_high.push_back(v); + m_low.push_back(v); + m_tmid.push_back(c[0]); + m_index[imid] = igrp = static_cast(m_high.size()); + m_ngroups++; + } + m_group_map[index] = igrp; + m_posInGroup_map[index] = (int) m_low[igrp-1].size(); + doublereal tlow = minTemp; + doublereal tmid = c[0]; + doublereal thigh = maxTemp; + + const doublereal* clow = c + 1; + const doublereal* chigh = c + 8; + m_high[igrp-1].push_back(ShomatePoly(index, tmid, thigh, + refPressure, chigh)); + m_low[igrp-1].push_back(ShomatePoly(index, tlow, tmid, + refPressure, clow)); + if (tlow > m_tlow_max) m_tlow_max = tlow; + if (thigh < m_thigh_min) m_thigh_min = thigh; - doublereal tt = 1.e-3*t; - m_t[0] = tt; - m_t[1] = tt*tt; - m_t[2] = m_t[1]*tt; - m_t[3] = 1.0/m_t[1]; - m_t[4] = log(tt); - m_t[5] = 1.0/GasConstant; - m_t[6] = 1.0/(GasConstant * t); + if ((int) m_tlow.size() < index + 1) { + m_tlow.resize(index + 1, tlow); + m_thigh.resize(index + 1, thigh); + } + m_tlow[index] = tlow; + m_thigh[index] = thigh; - int grp = m_group_map[k]; - int pos = m_posInGroup_map[k]; - const vector &mlg = m_low[grp-1]; - const ShomatePoly *nlow = &(mlg[pos]); + if (m_p0 < 0.0) { + m_p0 = refPressure; + } else if (fabs(m_p0 - refPressure) > 0.1) { + string logmsg = " WARNING ShomateThermo: New Species, " + name + + ", has a different reference pressure, " + + fp2str(refPressure) + ", than existing reference pressure, " + fp2str(m_p0) + "\n"; + writelog(logmsg); + logmsg = " This may become a fatal error in the future \n"; + writelog(logmsg); + } + m_p0 = refPressure; + + } - doublereal tmid = nlow->maxTemp(); - if (t < tmid) { - nlow->updateProperties(&m_t[0], cp_R, h_RT, s_R); - } else { - const vector &mhg = m_high[grp-1]; - const ShomatePoly *nhigh = &(mhg[pos]); - nhigh->updateProperties(&m_t[0], cp_R, h_RT, s_R); - } - } + //! Like update(), but only updates the single species k. + /*! + * @param k species index + * @param t Temperature (Kelvin) + * @param cp_R Vector of Dimensionless heat capacities. + * (length m_kk). + * @param h_RT Vector of Dimensionless enthalpies. + * (length m_kk). + * @param s_R Vector of Dimensionless entropies. + * (length m_kk). + */ + virtual void update_one(int k, doublereal t, doublereal* cp_R, + doublereal* h_RT, doublereal* s_R) const { - virtual void update(doublereal t, doublereal* cp_R, - doublereal* h_RT, doublereal* s_R) const { - int i; + doublereal tt = 1.e-3*t; + m_t[0] = tt; + m_t[1] = tt*tt; + m_t[2] = m_t[1]*tt; + m_t[3] = 1.0/m_t[1]; + m_t[4] = log(tt); + m_t[5] = 1.0/GasConstant; + m_t[6] = 1.0/(GasConstant * t); - doublereal tt = 1.e-3*t; - m_t[0] = tt; - m_t[1] = tt*tt; - m_t[2] = m_t[1]*tt; - m_t[3] = 1.0/m_t[1]; - m_t[4] = log(tt); - m_t[5] = 1.0/GasConstant; - m_t[6] = 1.0/(GasConstant * t); + int grp = m_group_map[k]; + int pos = m_posInGroup_map[k]; + const vector &mlg = m_low[grp-1]; + const ShomatePoly *nlow = &(mlg[pos]); - vector::const_iterator _begin, _end; - for (i = 0; i != m_ngroups; i++) { - if (t > m_tmid[i]) { - _begin = m_high[i].begin(); - _end = m_high[i].end(); - } - else { - _begin = m_low[i].begin(); - _end = m_low[i].end(); - } - for (; _begin != _end; ++_begin) { - _begin->updateProperties(&m_t[0], cp_R, h_RT, s_R); - } - } - } + doublereal tmid = nlow->maxTemp(); + if (t < tmid) { + nlow->updateProperties(&m_t[0], cp_R, h_RT, s_R); + } else { + const vector &mhg = m_high[grp-1]; + const ShomatePoly *nhigh = &(mhg[pos]); + nhigh->updateProperties(&m_t[0], cp_R, h_RT, s_R); + } + } - virtual doublereal minTemp(int k=-1) const { - if (k < 0) - return m_tlow_max; - else - return m_tlow[k]; - } + //! Compute the reference-state properties for all species. + /*! + * Given temperature T in K, this method updates the values of + * the non-dimensional heat capacity at constant pressure, + * enthalpy, and entropy, at the reference pressure, Pref + * of each of the standard states. + * + * @param t Temperature (Kelvin) + * @param cp_R Vector of Dimensionless heat capacities. + * (length m_kk). + * @param h_RT Vector of Dimensionless enthalpies. + * (length m_kk). + * @param s_R Vector of Dimensionless entropies. + * (length m_kk). + */ + virtual void update(doublereal t, doublereal* cp_R, + doublereal* h_RT, doublereal* s_R) const { + int i; - virtual doublereal maxTemp(int k=-1) const { - if (k < 0) - return m_thigh_min; - else - return m_thigh[k]; - } + doublereal tt = 1.e-3*t; + m_t[0] = tt; + m_t[1] = tt*tt; + m_t[2] = m_t[1]*tt; + m_t[3] = 1.0/m_t[1]; + m_t[4] = log(tt); + m_t[5] = 1.0/GasConstant; + m_t[6] = 1.0/(GasConstant * t); - virtual doublereal refPressure(int k=-1) const { - return m_p0; - } + vector::const_iterator _begin, _end; + for (i = 0; i != m_ngroups; i++) { + if (t > m_tmid[i]) { + _begin = m_high[i].begin(); + _end = m_high[i].end(); + } + else { + _begin = m_low[i].begin(); + _end = m_low[i].end(); + } + for (; _begin != _end; ++_begin) { + _begin->updateProperties(&m_t[0], cp_R, h_RT, s_R); + } + } + } - virtual int reportType(int index) const { return SHOMATE; } + //! Minimum temperature. + /*! + * If no argument is supplied, this + * method returns the minimum temperature for which \e all + * parameterizations are valid. If an integer index k is + * supplied, then the value returned is the minimum + * temperature for species k in the phase. + * + * @param k Species index + */ + virtual doublereal minTemp(int k=-1) const { + if (k < 0) + return m_tlow_max; + else + return m_tlow[k]; + } - /** - * This utility function reports back the type of - * parameterization and all of the parameters for the - * species, index. - * For the NASA object, there are 15 coefficients. - */ - virtual void reportParams(int index, int &type, - doublereal * const c, - doublereal &minTemp, - doublereal &maxTemp, - doublereal &refPressure) const { - type = reportType(index); - if (type == SHOMATE) { - int grp = m_group_map[index]; - int pos = m_posInGroup_map[index]; - int itype = SHOMATE; - const vector &mlg = m_low[grp-1]; - const vector &mhg = m_high[grp-1]; - const ShomatePoly *lowPoly = &(mlg[pos]); - const ShomatePoly *highPoly = &(mhg[pos]); - doublereal tmid = lowPoly->maxTemp(); - c[0] = tmid; - int n; - double ttemp; - lowPoly->reportParameters(n, itype, minTemp, ttemp, refPressure, - c + 1); - if (n != index) { - throw CanteraError(" ", "confused"); - } - if (itype != SHOMATE && itype != SHOMATE1) { - throw CanteraError(" ", "confused"); - } - highPoly->reportParameters(n, itype, ttemp, maxTemp, - refPressure, c + 8); - if (n != index) { - throw CanteraError(" ", "confused"); - } - if (itype != SHOMATE && itype != SHOMATE1) { - throw CanteraError(" ", "confused"); - } - } else { - throw CanteraError(" ", "confused"); - } + //! Maximum temperature. + /*! + * If no argument is supplied, this + * method returns the maximum temperature for which \e all + * parameterizations are valid. If an integer index k is + * supplied, then the value returned is the maximum + * temperature for parameterization k. + * + * @param k species index + */ + virtual doublereal maxTemp(int k=-1) const { + if (k < 0) + return m_thigh_min; + else + return m_thigh[k]; + } + + //! The reference-state pressure for species k. + /*! + * + * returns the reference state pressure in Pascals for + * species k. If k is left out of the argument list, + * it returns the reference state pressure for the first + * species. + * Note that some SpeciesThermo implementations, such + * as those for ideal gases, require that all species + * in the same phase have the same reference state pressures. + * + * @param k species index + */ + virtual doublereal refPressure(int k=-1) const { + return m_p0; + } + + //! This utility function reports the type of parameterization + //! used for the species with index number index. + /*! + * + * @param index Species index + */ + virtual int reportType(int index) const { return SHOMATE; } + + /*! + * This utility function reports back the type of + * parameterization and all of the parameters for the + * species, index. + * + * @param index Species index + * @param type Integer type of the standard type + * @param c Vector of coefficients used to set the + * parameters for the standard state. + * + * @param minTemp output - Minimum temperature + * @param maxTemp output - Maximum temperature + * @param refPressure output - reference pressure (Pa). + */ + virtual void reportParams(int index, int &type, + doublereal * const c, + doublereal &minTemp, + doublereal &maxTemp, + doublereal &refPressure) const { + type = reportType(index); + if (type == SHOMATE) { + int grp = m_group_map[index]; + int pos = m_posInGroup_map[index]; + int itype = SHOMATE; + const vector &mlg = m_low[grp-1]; + const vector &mhg = m_high[grp-1]; + const ShomatePoly *lowPoly = &(mlg[pos]); + const ShomatePoly *highPoly = &(mhg[pos]); + doublereal tmid = lowPoly->maxTemp(); + c[0] = tmid; + int n; + double ttemp; + lowPoly->reportParameters(n, itype, minTemp, ttemp, refPressure, + c + 1); + if (n != index) { + throw CanteraError(" ", "confused"); + } + if (itype != SHOMATE && itype != SHOMATE1) { + throw CanteraError(" ", "confused"); + } + highPoly->reportParameters(n, itype, ttemp, maxTemp, + refPressure, c + 8); + if (n != index) { + throw CanteraError(" ", "confused"); + } + if (itype != SHOMATE && itype != SHOMATE1) { + throw CanteraError(" ", "confused"); + } + } else { + throw CanteraError(" ", "confused"); + } + } + + //! Modify parameters for the standard state + /*! + * @param index Species index + * @param c Vector of coefficients used to set the + * parameters for the standard state. + */ + virtual void modifyParams(int index, doublereal *c) { + int type = reportType(index); + if (type == SHOMATE) { + int grp = m_group_map[index]; + int pos = m_posInGroup_map[index]; + vector &mlg = m_low[grp-1]; + vector &mhg = m_high[grp-1]; + ShomatePoly *lowPoly = &(mlg[pos]); + ShomatePoly *highPoly = &(mhg[pos]); + doublereal tmid = lowPoly->maxTemp(); + if (fabs(c[0] - tmid) > 0.001) { + throw CanteraError("modifyParams", "can't change mid temp"); } - protected: + lowPoly->modifyParameters(c + 1); - //mutable map m_low_map; - //mutable map m_high_map; - vector > m_high; - vector > m_low; - map m_index; - vector_fp m_tmid; - doublereal m_tlow_max; - doublereal m_thigh_min; - vector_fp m_tlow; - vector_fp m_thigh; - doublereal m_p0; - int m_ngroups; - mutable vector_fp m_t; + highPoly->modifyParameters(c + 8); - /* - * This map takes as its index, the species index in the phase. - * It returns the group index, where the temperature polynomials - * for that species are storred. group indecises start at 1, - * so a decrement is always performed to access vectors. - */ - mutable map m_group_map; + } else { + throw CanteraError(" ", "confused"); + } + } - /* - * This map takes as its index, the species index in the phase. - * It returns the position index within the group, where the - * temperature polynomials for that species are storred. - */ - mutable map m_posInGroup_map; - }; + protected: + + //! Vector of vector of NasaPoly1's for the high temp region. + /*! + * This is the high temp region representation. + * The first Length is equal to the number of groups. + * The second vector is equal to the number of species + * in that particular group. + */ + vector > m_high; + + //! Vector of vector of NasaPoly1's for the low temp region. + /*! + * This is the low temp region representation. + * The first Length is equal to the number of groups. + * The second vector is equal to the number of species + * in that particular group. + */ + vector > m_low; + + //! Map between the midpoint temperature, as an int, to the group number + /*! + * Length is equal to the number of groups. Only used in the setup. + */ + map m_index; + + //! Vector of log temperature limits + /*! + * Length is equal to the number of groups. + */ + vector_fp m_tmid; + + //! Maximum value of the low temperature limit + doublereal m_tlow_max; + + //! Minimum value of the high temperature limit + doublereal m_thigh_min; + + //! Vector of low temperature limits (species index) + /*! + * Length is equal to number of species + */ + vector_fp m_tlow; + + //! Vector of low temperature limits (species index) + /*! + * Length is equal to number of species + */ + vector_fp m_thigh; + + //! Reference pressure (Pa) + /*! + * all species must have the same reference pressure. + */ + doublereal m_p0; + + //! number of groups + int m_ngroups; + + //! Vector of temperature polynomials + mutable vector_fp m_t; + + /*! + * This map takes as its index, the species index in the phase. + * It returns the group index, where the temperature polynomials + * for that species are stored. group indecises start at 1, + * so a decrement is always performed to access vectors. + */ + mutable map m_group_map; + + /*! + * This map takes as its index, the species index in the phase. + * It returns the position index within the group, where the + * temperature polynomials for that species are storred. + */ + mutable map m_posInGroup_map; + }; } diff --git a/Cantera/src/SimpleThermo.h b/Cantera/src/SimpleThermo.h index 9f347db76..ec9b99a41 100644 --- a/Cantera/src/SimpleThermo.h +++ b/Cantera/src/SimpleThermo.h @@ -1,5 +1,10 @@ /* * $Id$ + * + * @file SimpleSpecies.h + * + * Contains the definition and declarations for the SimpleSpecies + * standard state species thermodynamic property manager for a phase. */ #ifndef CT_SIMPLETHERMO_H @@ -9,129 +14,363 @@ namespace Cantera { - /** - * A simple species thermodynamic property manager. - */ - class SimpleThermo : public SpeciesThermo { + /** + * A constant-heat capacity species thermodynamic property manager class. + * This makes the + * assumption that the heat capacity is a constant. Then, the following + * relations are used to complete the specification of the thermodynamic + * functions for each species in the phase. + * + * \f[ + * \frac{c_p(T)}{R} = Cp0\_R + * \f] + * \f[ + * \frac{h^0(T)}{RT} = \frac{1}{T} * (h0\_R + (T - T_0) * Cp0\_R) + * \f] + * \f[ + * \frac{s^0(T)}{R} = (s0\_R + (log(T) - log(T_0)) * Cp0\_R) + * \f] + * + * This parameterization takes 4 input values. These are: + * - c[0] = \f$ T_0 \f$(Kelvin) + * - c[1] = \f$ H_k^o(T_0, p_{ref}) \f$ (J/kmol) + * - c[2] = \f$ S_k^o(T_0, p_{ref}) \f$ (J/kmol K) + * - c[3] = \f$ {Cp}_k^o(T_0, p_{ref}) \f$ (J(kmol K) + * + * All species must have the same reference pressure. + * The single-species standard-state property Manager ConstCpPoly has the same + * parameterization as the SimpleThermo class does. + * + * @see ConstCpPoly + * + * @ingroup spthermo + */ + class SimpleThermo : public SpeciesThermo { - public: + public: - const int ID; + //! Initialized to the type of parameterization + /*! + * Note, this value is used in some template functions. For this object the + * value is SIMPLE. + */ + const int ID; - SimpleThermo() : - ID(SIMPLE), - m_tlow_max(0.0), - m_thigh_min(1.e30), - m_p0(-1.0), m_nsp(0) {} + //! Constructor + SimpleThermo() : + ID(SIMPLE), + m_tlow_max(0.0), + m_thigh_min(1.e30), + m_p0(-1.0), + m_nspData(0) {} + //! Destructor + virtual ~SimpleThermo() {} - virtual ~SimpleThermo() {} + //! Install a new species thermodynamic property + //! parameterization for one species. + /*! + * + * @param name String name of the species + * @param index Species index, k + * @param type int flag specifying the type of parameterization to be + * installed. + * @param c Vector of coefficients for the parameterization. + * There are 4 coefficients. The values (and units) are the following + * - c[0] = \f$ T_0 \f$(Kelvin) + * - c[1] = \f$ H_k^o(T_0, p_{ref}) \f$ (J/kmol) + * - c[2] = \f$ S_k^o(T_0, p_{ref}) \f$ (J/kmol K) + * - c[3] = \f$ {Cp}_k^o(T_0, p_{ref}) \f$ (J(kmol K) + * + * @param minTemp minimum temperature for which this parameterization + * is valid. + * @param maxTemp maximum temperature for which this parameterization + * is valid. + * @param refPressure standard-state pressure for this + * parameterization. + * + * @see ConstCpPoly + */ + virtual void install(string name, int index, int type, + const doublereal* c, + doublereal minTemp, doublereal maxTemp, doublereal refPressure) { + //writelog("installing const_cp for species "+name+"\n"); + m_logt0.push_back(log(c[0])); + m_t0.push_back(c[0]); + m_h0_R.push_back(c[1]/GasConstant); + m_s0_R.push_back(c[2]/GasConstant); + m_cp0_R.push_back(c[3]/GasConstant); + m_index.push_back(index); + m_loc[index] = m_nspData; + m_nspData++; + doublereal tlow = minTemp; + doublereal thigh = maxTemp; + + if (tlow > m_tlow_max) m_tlow_max = tlow; + if (thigh < m_thigh_min) m_thigh_min = thigh; + + if ((int) m_tlow.size() < index + 1) { + m_tlow.resize(index + 1, tlow); + m_thigh.resize(index + 1, thigh); + } + m_tlow[index] = tlow; + m_thigh[index] = thigh; - virtual void install(string name, int index, int type, - const doublereal* c, - doublereal minTemp, doublereal maxTemp, doublereal refPressure) { - //writelog("installing const_cp for species "+name+"\n"); - m_logt0.push_back(log(c[0])); - m_t0.push_back(c[0]); - m_h0_R.push_back(c[1]/GasConstant); - m_s0_R.push_back(c[2]/GasConstant); - m_cp0_R.push_back(c[3]/GasConstant); - m_index.push_back(index); - m_loc[index] = m_nsp; - m_nsp++; - doublereal tlow = minTemp; - doublereal thigh = maxTemp; - m_p0 = refPressure; - if (tlow > m_tlow_max) m_tlow_max = tlow; - if (thigh < m_thigh_min) m_thigh_min = thigh; - m_tlow.push_back(tlow); - m_thigh.push_back(thigh); - } + if (m_p0 < 0.0) { + m_p0 = refPressure; + } else if (fabs(m_p0 - refPressure) > 0.1) { + string logmsg = " WARNING SimpleThermo: New Species, " + name + + ", has a different reference pressure, " + + fp2str(refPressure) + ", than existing reference pressure, " + fp2str(m_p0) + "\n"; + writelog(logmsg); + logmsg = " This may become a fatal error in the future \n"; + writelog(logmsg); + } + m_p0 = refPressure; + } + //! Compute the reference-state properties for all species. + /*! + * Given temperature T in K, this method updates the values of + * the non-dimensional heat capacity at constant pressure, + * enthalpy, and entropy, at the reference pressure, Pref + * of each of the standard states. + * + * @param t Temperature (Kelvin) + * @param cp_R Vector of Dimensionless heat capacities. + * (length m_kk). + * @param h_RT Vector of Dimensionless enthalpies. + * (length m_kk). + * @param s_R Vector of Dimensionless entropies. + * (length m_kk). + */ + virtual void update(doublereal t, doublereal* cp_R, + doublereal* h_RT, doublereal* s_R) const { + int k, ki; + doublereal logt = log(t); + doublereal rt = 1.0/t; + for (k = 0; k < m_nspData; k++) { + ki = m_index[k]; + cp_R[ki] = m_cp0_R[k]; + h_RT[ki] = rt*(m_h0_R[k] + (t - m_t0[k]) * m_cp0_R[k]); + s_R[ki] = m_s0_R[k] + m_cp0_R[k] * (logt - m_logt0[k]); + } + } - virtual void update(doublereal t, doublereal* cp_R, - doublereal* h_RT, doublereal* s_R) const { - int k, ki; - doublereal logt = log(t); - doublereal rt = 1.0/t; - for (k = 0; k < m_nsp; k++) { - ki = m_index[k]; - cp_R[ki] = m_cp0_R[k]; - h_RT[ki] = rt*(m_h0_R[k] + (t - m_t0[k]) * m_cp0_R[k]); - s_R[ki] = m_s0_R[k] + m_cp0_R[k] * (logt - m_logt0[k]); - } - } + //! Like update(), but only updates the single species k. + /*! + * @param k species index + * @param t Temperature (Kelvin) + * @param cp_R Vector of Dimensionless heat capacities. + * (length m_kk). + * @param h_RT Vector of Dimensionless enthalpies. + * (length m_kk). + * @param s_R Vector of Dimensionless entropies. + * (length m_kk). + */ + virtual void update_one(int k, doublereal t, doublereal* cp_R, + doublereal* h_RT, doublereal* s_R) const { + doublereal logt = log(t); + doublereal rt = 1.0/t; + int loc = m_loc[k]; + cp_R[k] = m_cp0_R[loc]; + h_RT[k] = rt*(m_h0_R[loc] + (t - m_t0[loc]) * m_cp0_R[loc]); + s_R[k] = m_s0_R[loc] + m_cp0_R[loc] * (logt - m_logt0[loc]); + } - virtual void update_one(int k, doublereal t, doublereal* cp_R, - doublereal* h_RT, doublereal* s_R) const { - doublereal logt = log(t); - doublereal rt = 1.0/t; - int loc = m_loc[k]; - cp_R[k] = m_cp0_R[loc]; - h_RT[k] = rt*(m_h0_R[loc] + (t - m_t0[loc]) * m_cp0_R[loc]); - s_R[k] = m_s0_R[loc] + m_cp0_R[loc] * (logt - m_logt0[loc]); - } + //! Minimum temperature. + /*! + * If no argument is supplied, this + * method returns the minimum temperature for which \e all + * parameterizations are valid. If an integer index k is + * supplied, then the value returned is the minimum + * temperature for species k in the phase. + * + * @param k Species index + */ + virtual doublereal minTemp(int k=-1) const { + if (k < 0) + return m_tlow_max; + else + return m_tlow[m_loc[k]]; + } - virtual doublereal minTemp(int k=-1) const { - if (k < 0) - return m_tlow_max; - else - return m_tlow[m_loc[k]]; - } + //! Maximum temperature. + /*! + * If no argument is supplied, this + * method returns the maximum temperature for which \e all + * parameterizations are valid. If an integer index k is + * supplied, then the value returned is the maximum + * temperature for parameterization k. + * + * @param k Species Index + */ + virtual doublereal maxTemp(int k=-1) const { + if (k < 0) + return m_thigh_min; + else + return m_thigh[m_loc[k]]; + } - virtual doublereal maxTemp(int k=-1) const { - if (k < 0) - return m_thigh_min; - else - return m_thigh[m_loc[k]]; - } + //! The reference-state pressure for species k. + /*! + * + * returns the reference state pressure in Pascals for + * species k. If k is left out of the argument list, + * it returns the reference state pressure for the first + * species. + * Note that some SpeciesThermo implementations, such + * as those for ideal gases, require that all species + * in the same phase have the same reference state pressures. + * + * @param k Species Index + */ + virtual doublereal refPressure(int k=-1) const {return m_p0;} - virtual doublereal refPressure(int k=-1) const {return m_p0;} + //! This utility function reports the type of parameterization + //! used for the species with index number index. + /*! + * + * @param index Species index + */ + virtual int reportType(int index) const { return SIMPLE; } - virtual int reportType(int index) const { return SIMPLE; } + /*! + * This utility function reports back the type of + * parameterization and all of the parameters for the + * species, index. + * + * @param index Species index + * @param type Integer type of the standard type + * @param c Vector of coefficients used to set the + * parameters for the standard state. + * For the SimpleThermo object, there are 4 coefficients. + * @param minTemp output - Minimum temperature + * @param maxTemp output - Maximum temperature + * @param refPressure output - reference pressure (Pa). + * + */ + virtual void reportParams(int index, int &type, + doublereal * const c, + doublereal &minTemp, + doublereal &maxTemp, + doublereal &refPressure) const { + type = reportType(index); + int loc = m_loc[index]; + if (type == SIMPLE) { + c[0] = m_t0[loc]; + c[1] = m_h0_R[loc] * GasConstant; + c[2] = m_s0_R[loc] * GasConstant; + c[3] = m_cp0_R[loc] * GasConstant; + minTemp = m_tlow[loc]; + maxTemp = m_thigh[loc]; + refPressure = m_p0; + } + } - /** - * This utility function reports back the type of - * parameterization and all of the parameters for the - * species, index. - * For the SimpleThermo object, there are 4 coefficients. - */ - virtual void reportParams(int index, int &type, - doublereal * const c, - doublereal &minTemp, - doublereal &maxTemp, - doublereal &refPressure) const { - type = reportType(index); - int loc = m_loc[index]; - if (type == SIMPLE) { - c[0] = m_t0[loc]; - c[1] = m_h0_R[loc] * GasConstant; - c[2] = m_s0_R[loc] * GasConstant; - c[3] = m_cp0_R[loc] * GasConstant; - minTemp = m_tlow[loc]; - maxTemp = m_thigh[loc]; - refPressure = m_p0; - } - } + //! Modify parameters for the standard state + /*! + * The thermo parameterization for a single species is overwritten. + * + * @param index Species index + * @param c Vector of coefficients used to set the + * parameters for the standard state. + * Must be length >= 4. + */ + virtual void modifyParams(int index, doublereal *c) { + int loc = m_loc[index]; + if (loc < 0) { + throw CanteraError("SimpleThermo::modifyParams", + "modifying parameters for species which hasn't been set yet"); + } + /* + * Change the data + */ + m_t0[loc] = c[0]; + m_h0_R[loc] = c[1] / GasConstant; + m_s0_R[loc] = c[2] / GasConstant; + m_cp0_R[loc] = c[3] / GasConstant; + } + protected: - protected: + //! Mapping between the species index and the vector index where the coefficients are kept + /*! + * This object doesn't have a one-to one correspondence between the species index, kspec, + * and the data location index,indexData, m_cp0_R[indexData]. + * This index keeps track of it. + * indexData = m_loc[kspec] + */ + mutable map m_loc; - mutable map m_loc; - vector_int m_index; - doublereal m_tlow_max; - doublereal m_thigh_min; - vector_fp m_tlow; - vector_fp m_thigh; - vector_fp m_t0; - vector_fp m_logt0; - vector_fp m_h0_R; - vector_fp m_s0_R; - vector_fp m_cp0_R; - doublereal m_p0; - int m_nsp; + //! Map between the vector index where the coefficients are kept and the species index + /*! + * Length is equal to the number of dataPoints. + * kspec = m_index[indexData] + */ + vector_int m_index; - }; + //! Maximum value of the low temperature limit + doublereal m_tlow_max; + + //! Minimum value of the high temperature limit + doublereal m_thigh_min; + + //! Vector of low temperature limits (species index) + /*! + * Length is equal to number of data points + */ + vector_fp m_tlow; + + //! Vector of low temperature limits (species index) + /*! + * Length is equal to number of data points + */ + vector_fp m_thigh; + + //! Vector of base temperatures (kelvin) + /*! + * Length is equal to the number of species data points + */ + vector_fp m_t0; + + //! Vector of base log temperatures (kelvin) + /*! + * Length is equal to the number of species data points + */ + vector_fp m_logt0; + + //! Vector of base dimensionless Enthalpies + /*! + * Length is equal to the number of species data points + */ + vector_fp m_h0_R; + + //! Vector of base dimensionless Entropies + /*! + * Length is equal to the number of species data points + */ + vector_fp m_s0_R; + + //! Vector of base dimensionless heat capacities + /*! + * Length is equal to the number of species data points + */ + vector_fp m_cp0_R; + + //! Reference pressure (Pa) + /*! + * all species must have the same reference pressure. + */ + doublereal m_p0; + + //! Number of species data points in the object. + /*! + * This is less than or equal to the number of species in the phase. + */ + int m_nspData; + + }; } diff --git a/Cantera/src/SpeciesThermo.h b/Cantera/src/SpeciesThermo.h index 0d3ecdea0..f0354d23d 100755 --- a/Cantera/src/SpeciesThermo.h +++ b/Cantera/src/SpeciesThermo.h @@ -70,28 +70,57 @@ namespace Cantera { * phase during each call. * * - * The following classes inherit from %SpeciesThermo + * The following classes inherit from %SpeciesThermo. Each of these classes + * handle multiple species, usually all of the species in a phase. * * - NasaThermo in file NasaThermo.h * - This is a two zone model, with each zone consisting of a 7 * coefficient Nasa Polynomial format. * . * - ShomateThermo in file ShomateThermo.h + * - This is a two zone model, with each zone consisting of a 7 + * coefficient Shomate Polynomial format. + * . * - SimpleThermo in file SimpleThermo.h + * - This is a one-zone constant heat capacity model. + * . * - GeneralSpeciesThermo in file GeneralSpeciesThermo.h + * - This is a general model. Each species is handled separately + * via a vector over SpeciesThermoInerpType classes. + * . * - SpeciesThermo1 in file SpeciesThermoMgr.h * - SpeciesThermoDuo in file SpeciesThermoMgr.h + * - This is a combination of two SpeciesThermo types. + * . * . - * The class SpeciesThermoInterpType is a virtual base class for + * The class SpeciesThermoInterpType is a pure virtual base class for * calculation of thermodynamic functions for a single species * in its reference state. * The following classes inherit from %SpeciesThermoInterpType * - NasaPoly1 in file NasaPoly1.h + * - This is a one zone model, consisting of a 7 + * coefficient Nasa Polynomial format. + * . * - NasaPoly2 in file NasaPoly2.h + * - This is a two zone model, with each zone consisting of a 7 + * coefficient Nasa Polynomial format. + * . * - ShomatePoly in file ShomatePoly.h + * - This is a one zone model, consisting of a 7 + * coefficient Shomate Polynomial format. + * . * - ShomatePoly2 in file ShomatePoly.h + * - This is a two zone model, with each zone consisting of a 7 + * coefficient Shomate Polynomial format. + * . * - ConstCpPoly in file ConstCpPoly.h + * - This is a one-zone constant heat capacity model. + * . * - Mu0Poly in file Mu0Poly.h + * - This is a multizoned model. The chemical potential is given + * at a set number of temperatures. Between each temperature + * the heat capacity is treated as a constant. + * . * . */ //@{ @@ -99,7 +128,7 @@ namespace Cantera { //////////////////////// class SpeciesThermo //////////////////// /*! - * Virtual base class for the species thermo manager classes. This + * Pure Virtual base class for the species thermo manager classes. This * class defines the interface which all subclasses must * implement. * @@ -121,8 +150,8 @@ namespace Cantera { virtual ~SpeciesThermo() {} - //! install a new species thermodynamic property - //! parameterization for one species. + //! Install a new species thermodynamic property + //! parameterization for one species. /*! * * @param name Name of the species @@ -209,7 +238,7 @@ namespace Cantera { * supplied, then the value returned is the maximum * temperature for parameterization k. * - * @param k index for parameterization k + * @param k Species Index */ virtual doublereal maxTemp(int k=-1) const =0; @@ -224,7 +253,7 @@ namespace Cantera { * as those for ideal gases, require that all species * in the same phase have the same reference state pressures. * - * @param k index for parameterization k + * @param k Species Index */ virtual doublereal refPressure(int k=-1) const =0; @@ -262,7 +291,7 @@ namespace Cantera { * @param c Vector of coefficients used to set the * parameters for the standard state. */ - virtual void modifyParams(int index, doublereal *c) {} + virtual void modifyParams(int index, doublereal *c) = 0; }; //@} diff --git a/Cantera/src/SpeciesThermoInterpType.h b/Cantera/src/SpeciesThermoInterpType.h index 04e8ba4e9..fc2397b31 100644 --- a/Cantera/src/SpeciesThermoInterpType.h +++ b/Cantera/src/SpeciesThermoInterpType.h @@ -28,6 +28,16 @@ namespace Cantera { * a phase. Therefore, this class must carry along a species index into that * vector. * + * These routine may be templated. A key requirement of the template is that + * there is a constructor with the following form: + * + * @code + * SpeciesThermoInterpType(int index, doublereal tlow, doublereal thigh, + * doublereal pref, const doublereal* coeffs) + * @endcode + * + * The constructor is used to instantiate the object. + * * @ingroup spthermo */ class SpeciesThermoInterpType { @@ -120,8 +130,6 @@ namespace Cantera { * @param refPressure output - reference pressure (Pa). * @param coeffs Vector of coefficients used to set the * parameters for the standard state. - * - * @todo should be a const function. */ virtual void reportParameters(int &index, int &type, doublereal &minTemp, doublereal &maxTemp, diff --git a/Cantera/src/SpeciesThermoMgr.h b/Cantera/src/SpeciesThermoMgr.h index 63b2c16a4..b653237c3 100755 --- a/Cantera/src/SpeciesThermoMgr.h +++ b/Cantera/src/SpeciesThermoMgr.h @@ -310,6 +310,24 @@ namespace Cantera { } } + //! Modify parameters for the standard state + /*! + * @param index Species index + * @param c Vector of coefficients used to set the + * parameters for the standard state. + */ + virtual void modifyParams(int index, doublereal *c) { + int ctype = reportType(index); + if (ctype == m_thermo1.ID) { + m_thermo1.modifyParams(index, c); + } else if (ctype == m_thermo2.ID) { + m_thermo2.modifyParams(index, c); + } else { + throw CanteraError("modifyParams", "confused"); + } + } + + private: //! Thermo Type 1 @@ -445,13 +463,23 @@ namespace Cantera { * @param maxTemp output - Maximum temperature * @param refPressure output - reference pressure (Pa). */ - virtual void reportParams(int index, int &type, + virtual void reportParams(int index, int &type, doublereal * const c, doublereal &minTemp, doublereal &maxTemp, - doublereal &refPressure) const { - m_thermo[index]->reportParameters(index, type, c, minTemp, maxTemp, refPressure); - } + doublereal &refPressure) const { + m_thermo[index]->reportParameters(index, type, c, minTemp, maxTemp, refPressure); + } + + //! Modify parameters for the standard state + /*! + * @param index Species index + * @param c Vector of coefficients used to set the + * parameters for the standard state. + */ + virtual void modifyParams(int index, doublereal *c) { + m_thermo[index]->modifyParameters(index, c); + } private: //! Vector of SPM objects. There are m_kk of them @@ -464,9 +492,3 @@ namespace Cantera { } #endif - - - - - - diff --git a/test_problems/diamondSurf/runtest b/test_problems/diamondSurf/runtest index 152f8ad5a..6a83db49e 100755 --- a/test_problems/diamondSurf/runtest +++ b/test_problems/diamondSurf/runtest @@ -4,6 +4,7 @@ temp_success="1" /bin/rm -f output.txt outputa.txt +tname="diamondSurf" ################################################################# # @@ -16,7 +17,7 @@ retnStat=$? if [ $retnStat != "0" ] then temp_success="0" - echo "runDiamond returned with bad status, $retnStat, check output" + echo "runDiamond ($tname test) returned with bad status, $retnStat, check output" fi ../../bin/exp3to2.sh output.txt > outputa.txt @@ -24,9 +25,9 @@ diff -w outputa.txt runDiamond_blessed.out > diff_test.out retnStat=$? if [ $retnStat = "0" ] then - echo "successful diff comparison on diamond test" + echo "successful diff comparison on $tname test" else - echo "unsuccessful diff comparison on diamond test" + echo "unsuccessful diff comparison on $tname test" echo "FAILED" > csvCode.txt temp_success="0" fi @@ -36,9 +37,9 @@ diff -w diamonda.xml diamond_blessed.xml > xml_diff_test.out retnStat=$? if [ $retnStat = "0" ] then - echo "successful diff comparison on diamond.xml test" + echo "successful diff comparison on $tname diamond.xml test" else - echo "unsuccessful diff comparison on diamond.xml test" + echo "unsuccessful diff comparison on $thame diamond.xml test" echo "FAILED" > csvCode.txt temp_success="0" fi diff --git a/tools/doc/Cantera.cfg.in b/tools/doc/Cantera.cfg.in index 44b3c9ce8..851fbe215 100755 --- a/tools/doc/Cantera.cfg.in +++ b/tools/doc/Cantera.cfg.in @@ -104,6 +104,7 @@ FILE_PATTERNS = Kinetics.h Kinetics.cpp \ SpeciesThermoFactory.h SpeciesThermoFactory.cpp \ speciesThermoTypes.h SpeciesThermoMgr.h SpeciesThermo.h SpeciesThermoInterpTypes.h \ NasaThermo.h NasaPoly1.h NasaPoly2.h \ + ShomateThermo.h ShomatePoly.h SimpleThermo.h \ utilities.h \ VPStandardStateTP.h VPStandardStateTP.cpp \ SingleSpeciesTP.h SingleSpeciesTP.cpp \