From 0a3332aa43c19a5c062e96705153b78e726168e6 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 22 Jan 2015 00:04:06 +0000 Subject: [PATCH] [Thermo] Add simpler constructors for SpeciesThermoInterpType objects These objects do not need to know the index of the species within the phase, so the new constructors do not take that as an argument. For the NASA polynomial constructors, the order of the coefficients arrays in the new constructors has been modified to match the conventional ordering of the coefficients as written in thermo database files. --- include/cantera/thermo/AdsorbateThermo.h | 17 ++++++++ include/cantera/thermo/ConstCpPoly.h | 17 ++++++++ include/cantera/thermo/Mu0Poly.h | 28 +++++++++++++ include/cantera/thermo/Nasa9Poly1.h | 12 ++++++ include/cantera/thermo/NasaPoly1.h | 16 ++++++++ include/cantera/thermo/NasaPoly2.h | 25 +++++++++++- include/cantera/thermo/ShomatePoly.h | 39 +++++++++++++++++++ .../cantera/thermo/SpeciesThermoInterpType.h | 21 +++++++++- src/thermo/ConstCpPoly.cpp | 11 ++++++ src/thermo/Mu0Poly.cpp | 10 ++++- src/thermo/Nasa9Poly1.cpp | 7 ++++ src/thermo/SpeciesThermoFactory.cpp | 27 +++++-------- src/thermo/SpeciesThermoInterpType.cpp | 21 ++++++++++ test/thermo/phaseConstructors.cpp | 12 +++--- test/thermo/thermoParameterizations.cpp | 20 +++++----- test/thermo/thermo_data.h | 35 ++++++++--------- test/transport/transportFromScratch.cpp | 6 +-- 17 files changed, 266 insertions(+), 58 deletions(-) diff --git a/include/cantera/thermo/AdsorbateThermo.h b/include/cantera/thermo/AdsorbateThermo.h index 39a284948..636b216cb 100644 --- a/include/cantera/thermo/AdsorbateThermo.h +++ b/include/cantera/thermo/AdsorbateThermo.h @@ -41,6 +41,8 @@ public: * @param tlow output - Minimum temperature * @param thigh output - Maximum temperature * @param pref output - reference pressure (Pa). + * @deprecated Use the constructor which does not require the species index. + * To be removed after Cantera 2.2. */ Adsorbate(size_t n, doublereal tlow, doublereal thigh, doublereal pref, const doublereal* coeffs) @@ -52,6 +54,21 @@ public: std::copy(coeffs+2, coeffs + 2 + m_nFreqs, m_freq.begin()); } + //! Full Constructor + /*! + * @param tlow output - Minimum temperature + * @param thigh output - Maximum temperature + * @param pref output - reference pressure (Pa). + */ + Adsorbate(double tlow, double thigh, double pref, const double* coeffs) + : SpeciesThermoInterpType(tlow, thigh, pref) + { + m_nFreqs = int(coeffs[0]); + m_be = coeffs[1]; + m_freq.resize(m_nFreqs); + std::copy(coeffs+2, coeffs + 2 + m_nFreqs, m_freq.begin()); + } + /// Copy Constructor Adsorbate(const Adsorbate& b) : m_be(b.m_be) { diff --git a/include/cantera/thermo/ConstCpPoly.h b/include/cantera/thermo/ConstCpPoly.h index 364aff854..87e9f5b21 100644 --- a/include/cantera/thermo/ConstCpPoly.h +++ b/include/cantera/thermo/ConstCpPoly.h @@ -63,11 +63,28 @@ public: * - 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) + * @deprecated Use the constructor which does not take the species index. To + * be removed after Cantera 2.2. */ ConstCpPoly(size_t n, doublereal tlow, doublereal thigh, doublereal pref, const doublereal* coeffs); + //! Normal constructor + /*! + * @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 4 coefficients for the ConstCpPoly parameterization. + * - 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) + */ + ConstCpPoly(double tlow, double thigh, double pref, const double* coeffs); + //! copy constructor ConstCpPoly(const ConstCpPoly&); diff --git a/include/cantera/thermo/Mu0Poly.h b/include/cantera/thermo/Mu0Poly.h index ce5106a9b..5ba6a95ff 100644 --- a/include/cantera/thermo/Mu0Poly.h +++ b/include/cantera/thermo/Mu0Poly.h @@ -99,10 +99,38 @@ public: * - coeffs[7] = \f$ \mu^o(T_3) \f$ (J/kmol) * - ........ * . + * @deprecated Use the constructor which does not require the species index. + * To be removed after Cantera 2.2. */ Mu0Poly(size_t n, doublereal tlow, doublereal thigh, doublereal pref, const doublereal* coeffs); + //! Normal constructor + /*! + * In the constructor, we calculate and store the piecewise linear + * approximation to the thermodynamic functions. + * + * @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 \f$ 2+npoints*2 \f$ coefficients, where + * \f$ npoints \f$ are the number of temperature points. + * Their identity is further broken down: + * - coeffs[0] = number of points (integer) + * - coeffs[1] = \f$ h^o(298.15 K) \f$ (J/kmol) + * - coeffs[2] = \f$ T_1 \f$ (Kelvin) + * - coeffs[3] = \f$ \mu^o(T_1) \f$ (J/kmol) + * - coeffs[4] = \f$ T_2 \f$ (Kelvin) + * - coeffs[5] = \f$ \mu^o(T_2) \f$ (J/kmol) + * - coeffs[6] = \f$ T_3 \f$ (Kelvin) + * - coeffs[7] = \f$ \mu^o(T_3) \f$ (J/kmol) + * - ........ + * . + */ + Mu0Poly(double tlow, double thigh, double pref, const double* coeffs); + //! Copy constructor Mu0Poly(const Mu0Poly&); diff --git a/include/cantera/thermo/Nasa9Poly1.h b/include/cantera/thermo/Nasa9Poly1.h index 0073ad9f3..ec05dbab9 100644 --- a/include/cantera/thermo/Nasa9Poly1.h +++ b/include/cantera/thermo/Nasa9Poly1.h @@ -82,10 +82,22 @@ public: * @param pref reference pressure (Pa). * @param coeffs Vector of coefficients used to set the * parameters for the standard state. + * @deprecated Use the constructor whic hdoes not require the species + * index. To be removed after Cantera 2.2. */ Nasa9Poly1(size_t n, doublereal tlow, doublereal thigh, doublereal pref, const doublereal* coeffs); + //! Normal constructor + /*! + * @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. + */ + Nasa9Poly1(double tlow, double thigh, double pref, const double* coeffs); + //! copy constructor /*! * @param b object to be copied diff --git a/include/cantera/thermo/NasaPoly1.h b/include/cantera/thermo/NasaPoly1.h index c4913d901..cb11698cf 100644 --- a/include/cantera/thermo/NasaPoly1.h +++ b/include/cantera/thermo/NasaPoly1.h @@ -58,6 +58,8 @@ public: * @param pref reference pressure (Pa). * @param coeffs Vector of coefficients used to set the parameters for the * standard state, in the order [a5,a6,a0,a1,a2,a3,a4] + * @deprecated Use the constructor which does not take species index. To be + * removed after Cantera 2.2. */ NasaPoly1(size_t n, doublereal tlow, doublereal thigh, doublereal pref, const doublereal* coeffs) : @@ -71,6 +73,20 @@ public: m_coeff[6] = coeffs[1]; } + //! Normal constructor + /*! + * @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, in the order [a0,a1,a2,a3,a4,a5,a6] + */ + NasaPoly1(double tlow, double thigh, double pref, const double* coeffs) + : SpeciesThermoInterpType(tlow, thigh, pref) + , m_coeff(coeffs, coeffs+7) + { + } + //! copy constructor /*! * @param b object to be copied diff --git a/include/cantera/thermo/NasaPoly2.h b/include/cantera/thermo/NasaPoly2.h index e2393e952..02a341fbe 100644 --- a/include/cantera/thermo/NasaPoly2.h +++ b/include/cantera/thermo/NasaPoly2.h @@ -60,8 +60,10 @@ public: * @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. + * @param coeffs Vector of coefficients used to set the parameters for + * the standard state [Tmid, 7 low-T coeffs, 7 high-T coeffs] + * @deprecated Use constructor without species index. To be removed after + * Cantera 2.2. */ NasaPoly2(size_t n, doublereal tlow, doublereal thigh, doublereal pref, const doublereal* coeffs) : @@ -72,6 +74,25 @@ public: m_coeff(coeffs, coeffs + 15) { } + //! Full Constructor + /*! + * @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 [Tmid, 7 high-T coeffs, 7 low-T + * coeffs]. This is the coefficient order used in the + * standard NASA format. + */ + NasaPoly2(doublereal tlow, doublereal thigh, doublereal pref, + const doublereal* coeffs) : + SpeciesThermoInterpType(tlow, thigh, pref), + m_midT(coeffs[0]), + mnp_low(tlow, coeffs[0], pref, coeffs + 8), + mnp_high(coeffs[0], thigh, pref, coeffs + 1), + m_coeff(coeffs, coeffs + 15) { + } + //! Copy Constructor /*! * @param b object to be copied. diff --git a/include/cantera/thermo/ShomatePoly.h b/include/cantera/thermo/ShomatePoly.h index 7b599ac77..62fe47a2c 100644 --- a/include/cantera/thermo/ShomatePoly.h +++ b/include/cantera/thermo/ShomatePoly.h @@ -78,6 +78,9 @@ public: * * See the class description for the polynomial representation of the * thermo functions in terms of \f$ A, \dots, G \f$. + * + * @deprecated Use the alternate constructor which does not take the + * species index. To be removed after Cantera 2.2. */ ShomatePoly(size_t n, doublereal tlow, doublereal thigh, doublereal pref, const doublereal* coeffs) : @@ -86,6 +89,23 @@ public: { } + //! Normal constructor + /*! + * @param tlow Minimum temperature + * @param thigh Maximum temperature + * @param pref reference pressure (Pa). + * @param coeffs Vector of coefficients, [A,B,C,D,E,F,G], used to set + * the parameters for the species standard state. + * + * See the class description for the polynomial representation of the + * thermo functions in terms of \f$ A, \dots, G \f$. + */ + ShomatePoly(double tlow, double thigh, double pref, const double* coeffs) : + SpeciesThermoInterpType(tlow, thigh, pref), + m_coeff(coeffs, coeffs + 7) + { + } + //! copy constructor /*! * @param b object to be copied @@ -311,6 +331,8 @@ public: * 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. + * @deprecated Use the constructor that does not require the species index. + * To be removed after Cantera 2.2. */ ShomatePoly2(size_t n, doublereal tlow, doublereal thigh, doublereal pref, const doublereal* coeffs) : @@ -322,6 +344,23 @@ public: { } + //! Normal constructor + /*! + * @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. [Tmid, 7 low-T coeffs, 7 high-T coeffs] + */ + ShomatePoly2(double tlow, double thigh, double pref, const double* coeffs) : + SpeciesThermoInterpType(tlow, thigh, pref), + m_midT(coeffs[0]), + msp_low(tlow, coeffs[0], pref, coeffs+1), + msp_high(coeffs[0], thigh, pref, coeffs+8), + m_coeff(coeffs, coeffs + 15) + { + } + //! Copy constructor /*! * @param b object to be copied. diff --git a/include/cantera/thermo/SpeciesThermoInterpType.h b/include/cantera/thermo/SpeciesThermoInterpType.h index 9608db86d..3b0130db4 100644 --- a/include/cantera/thermo/SpeciesThermoInterpType.h +++ b/include/cantera/thermo/SpeciesThermoInterpType.h @@ -160,9 +160,13 @@ class SpeciesThermoInterpType public: SpeciesThermoInterpType(); + //! @deprecated Use the constructor without the species index. To be removed + //! after Cantera 2.2. SpeciesThermoInterpType(size_t n, doublereal tlow, doublereal thigh, doublereal pref); + SpeciesThermoInterpType(double tlow, double thigh, double pref); + SpeciesThermoInterpType(const SpeciesThermoInterpType& b); virtual ~SpeciesThermoInterpType() {} @@ -195,10 +199,12 @@ public: virtual int reportType() const = 0; //! Returns an integer representing the species index + //! @deprecated virtual size_t speciesIndex() const { return m_index; } + //! @deprecated virtual void setIndex(size_t index) { m_index = index; } @@ -310,7 +316,7 @@ protected: doublereal m_highT; //! Reference state pressure doublereal m_Pref; - //! species index + //! species index @deprecated size_t m_index; }; @@ -344,9 +350,22 @@ public: * * @param PDSS_ptr Pointer to the PDSS object that handles calls for * this object + * @deprecated Use the constructor which does not require the species + * index. To be removed after Cantera 2.2. */ STITbyPDSS(size_t speciesIndex, VPSSMgr* vpssmgr_ptr, PDSS* PDSS_ptr); + //! Main Constructor + /*! + * @param vpssmgr_ptr Pointer to the Variable pressure standard state + * manager that owns the PDSS object that will handle calls for this + * object + * + * @param PDSS_ptr Pointer to the PDSS object that handles calls for + * this object + */ + STITbyPDSS(VPSSMgr* vpssmgr_ptr, PDSS* PDSS_ptr); + //! copy constructor /*! * @param b Object to be copied diff --git a/src/thermo/ConstCpPoly.cpp b/src/thermo/ConstCpPoly.cpp index 4de9d3722..e0b396eff 100644 --- a/src/thermo/ConstCpPoly.cpp +++ b/src/thermo/ConstCpPoly.cpp @@ -31,6 +31,17 @@ ConstCpPoly::ConstCpPoly(size_t n, doublereal tlow, doublereal thigh, m_logt0 = log(m_t0); } +ConstCpPoly::ConstCpPoly(double tlow, double thigh, double pref, + const double* coeffs) : + SpeciesThermoInterpType(tlow, thigh, pref) +{ + m_t0 = coeffs[0]; + m_h0_R = coeffs[1] / GasConstant; + m_s0_R = coeffs[2] / GasConstant; + m_cp0_R = coeffs[3] / GasConstant; + m_logt0 = log(m_t0); +} + ConstCpPoly::ConstCpPoly(const ConstCpPoly& b) : SpeciesThermoInterpType(b), m_t0(b.m_t0), diff --git a/src/thermo/Mu0Poly.cpp b/src/thermo/Mu0Poly.cpp index 6c1f32997..3178202a6 100644 --- a/src/thermo/Mu0Poly.cpp +++ b/src/thermo/Mu0Poly.cpp @@ -30,6 +30,14 @@ Mu0Poly::Mu0Poly(size_t n, doublereal tlow, doublereal thigh, processCoeffs(coeffs); } +Mu0Poly::Mu0Poly(double tlow, double thigh, double pref, const double* coeffs) : + SpeciesThermoInterpType(tlow, thigh, pref), + m_numIntervals(0), + m_H298(0.0) +{ + processCoeffs(coeffs); +} + Mu0Poly::Mu0Poly(const Mu0Poly& b) : SpeciesThermoInterpType(b), m_numIntervals(b.m_numIntervals), @@ -195,7 +203,7 @@ Mu0Poly* newMu0ThermoFromXML(const std::string& speciesName, c[2+i*2+1] = cValues[i]; } - return new Mu0Poly(0, tmin, tmax, pref, &c[0]); + return new Mu0Poly(tmin, tmax, pref, &c[0]); } void Mu0Poly::processCoeffs(const doublereal* coeffs) diff --git a/src/thermo/Nasa9Poly1.cpp b/src/thermo/Nasa9Poly1.cpp index 640609691..195aa09eb 100644 --- a/src/thermo/Nasa9Poly1.cpp +++ b/src/thermo/Nasa9Poly1.cpp @@ -29,6 +29,13 @@ Nasa9Poly1::Nasa9Poly1(size_t n, doublereal tlow, doublereal thigh, { } +Nasa9Poly1::Nasa9Poly1(double tlow, double thigh, double pref, + const double* coeffs) : + SpeciesThermoInterpType(tlow, thigh, pref), + m_coeff(coeffs, coeffs + 9) +{ +} + Nasa9Poly1::Nasa9Poly1(const Nasa9Poly1& b) : SpeciesThermoInterpType(b), m_coeff(b.m_coeff) diff --git a/src/thermo/SpeciesThermoFactory.cpp b/src/thermo/SpeciesThermoFactory.cpp index 758150ecb..aed507b27 100644 --- a/src/thermo/SpeciesThermoFactory.cpp +++ b/src/thermo/SpeciesThermoFactory.cpp @@ -192,20 +192,20 @@ SpeciesThermoInterpType* newSpeciesThermoInterpType(int type, double tlow, { switch (type) { case NASA1: - return new NasaPoly1(0, tlow, thigh, pref, coeffs); + return new NasaPoly1(tlow, thigh, pref, coeffs); case SHOMATE1: - return new ShomatePoly(0, tlow, thigh, pref, coeffs); + return new ShomatePoly(tlow, thigh, pref, coeffs); case CONSTANT_CP: case SIMPLE: - return new ConstCpPoly(0, tlow, thigh, pref, coeffs); + return new ConstCpPoly(tlow, thigh, pref, coeffs); case MU0_INTERP: - return new Mu0Poly(0, tlow, thigh, pref, coeffs); + return new Mu0Poly(tlow, thigh, pref, coeffs); case SHOMATE2: - return new ShomatePoly2(0, tlow, thigh, pref, coeffs); + return new ShomatePoly2(tlow, thigh, pref, coeffs); case NASA2: - return new NasaPoly2(0, tlow, thigh, pref, coeffs); + return new NasaPoly2(tlow, thigh, pref, coeffs); case ADSORBATE: - return new Adsorbate(0, tlow, thigh, pref, coeffs); + return new Adsorbate(tlow, thigh, pref, coeffs); default: throw CanteraError("newSpeciesThermoInterpType", "Unknown species thermo type: " + int2str(type) + "."); @@ -304,17 +304,10 @@ static SpeciesThermoInterpType* newNasaThermoFromXML( "non-continuous temperature ranges."); } - // The NasaThermo species property manager expects the - // coefficients in a different order, so rearrange them. vector_fp c(15); c[0] = tmid; - - c[1] = c0[5]; - c[2] = c0[6]; - copy(c0.begin(), c0.begin()+5, c.begin() + 3); - c[8] = c1[5]; - c[9] = c1[6]; - copy(c1.begin(), c1.begin()+5, c.begin() + 10); + copy(c1.begin(), c1.begin()+7, c.begin() + 1); // high-T coefficients + copy(c0.begin(), c0.begin()+7, c.begin() + 8); // low-T coefficients return newSpeciesThermoInterpType(NASA, tmin, tmax, p0, &c[0]); } @@ -523,7 +516,7 @@ static SpeciesThermoInterpType* newNasa9ThermoFromXML( throw CanteraError("installNasa9ThermoFromXML", "Expected 9 coeff polynomial"); } - regionPtrs.push_back(new Nasa9Poly1(0, tmin, tmax, pref, &cPoly[0])); + regionPtrs.push_back(new Nasa9Poly1(tmin, tmax, pref, &cPoly[0])); nRegions++; } } diff --git a/src/thermo/SpeciesThermoInterpType.cpp b/src/thermo/SpeciesThermoInterpType.cpp index f8f135d0a..a7d535979 100644 --- a/src/thermo/SpeciesThermoInterpType.cpp +++ b/src/thermo/SpeciesThermoInterpType.cpp @@ -26,6 +26,20 @@ SpeciesThermoInterpType::SpeciesThermoInterpType(size_t n, doublereal tlow, m_highT(thigh), m_Pref(pref), m_index(n) +{ + warn_deprecated("Constructor SpeciesThermoInterpType(size_t n, ...)", + "Use the constructor which does not take a species index." + " Applies to all classes derived from SpeciesThermoInterpType." + " To be removed after Cantera 2.2."); +} + +SpeciesThermoInterpType::SpeciesThermoInterpType(double tlow, + double thigh, + double pref) : + m_lowT(tlow), + m_highT(thigh), + m_Pref(pref), + m_index(0) { } @@ -72,6 +86,13 @@ STITbyPDSS::STITbyPDSS(size_t k, VPSSMgr* vpssmgr_ptr, PDSS* PDSS_ptr) : m_index = k; } +STITbyPDSS::STITbyPDSS(VPSSMgr* vpssmgr_ptr, PDSS* PDSS_ptr) : + SpeciesThermoInterpType(), + m_vpssmgr_ptr(vpssmgr_ptr), + m_PDSS_ptr(PDSS_ptr) +{ +} + STITbyPDSS::STITbyPDSS(const STITbyPDSS& b) : SpeciesThermoInterpType(b), m_vpssmgr_ptr(b.m_vpssmgr_ptr), diff --git a/test/thermo/phaseConstructors.cpp b/test/thermo/phaseConstructors.cpp index 0ef826fdc..1fef8588e 100644 --- a/test/thermo/phaseConstructors.cpp +++ b/test/thermo/phaseConstructors.cpp @@ -106,17 +106,17 @@ class ConstructFromScratch : public testing::Test public: ConstructFromScratch() : sH2O("H2O", parseCompString("H:2 O:1"), - new NasaPoly2(0, 200, 3500, 101325, h2o_nasa_coeffs)) + new NasaPoly2(200, 3500, 101325, h2o_nasa_coeffs)) , sH2("H2", parseCompString("H:2"), - new NasaPoly2(0, 200, 3500, 101325, h2_nasa_coeffs)) + new NasaPoly2(200, 3500, 101325, h2_nasa_coeffs)) , sO2("O2", parseCompString("O:2"), - new NasaPoly2(0, 200, 3500, 101325, o2_nasa_coeffs)) + new NasaPoly2(200, 3500, 101325, o2_nasa_coeffs)) , sOH("OH", parseCompString("H:1 O:1"), - new NasaPoly2(0, 200, 3500, 101325, oh_nasa_coeffs)) + new NasaPoly2(200, 3500, 101325, oh_nasa_coeffs)) , sCO("CO", parseCompString("C:1 O:1"), - new NasaPoly2(0, 200, 3500, 101325, o2_nasa_coeffs)) + new NasaPoly2(200, 3500, 101325, o2_nasa_coeffs)) , sCO2("CO2", parseCompString("C:1 O:2"), - new NasaPoly2(0, 200, 3500, 101325, h2o_nasa_coeffs)) + new NasaPoly2(200, 3500, 101325, h2o_nasa_coeffs)) { } diff --git a/test/thermo/thermoParameterizations.cpp b/test/thermo/thermoParameterizations.cpp index dc073a6f1..263a8b704 100644 --- a/test/thermo/thermoParameterizations.cpp +++ b/test/thermo/thermoParameterizations.cpp @@ -32,9 +32,9 @@ TEST_F(SpeciesThermoInterpTypeTest, install_const_cp) { // Compare against instantiation from CTI file IdealGasPhase p2("../data/simplephases.cti", "simple1"); - SpeciesThermoInterpType* stit_o2 = new ConstCpPoly(0, 200, 5000, 101325, c_o2); - SpeciesThermoInterpType* stit_h2 = new ConstCpPoly(1, 200, 5000, 101325, c_h2); - SpeciesThermoInterpType* stit_h2o = new ConstCpPoly(2, 200, 5000, 101325, c_h2o); + SpeciesThermoInterpType* stit_o2 = new ConstCpPoly(200, 5000, 101325, c_o2); + SpeciesThermoInterpType* stit_h2 = new ConstCpPoly(200, 5000, 101325, c_h2); + SpeciesThermoInterpType* stit_h2o = new ConstCpPoly(200, 5000, 101325, c_h2o); p.addSpecies(Species("O2", parseCompString("O:2"), stit_o2)); p.addSpecies(Species("H2", parseCompString("H:2"), stit_h2)); p.addSpecies(Species("H2O", parseCompString("H:2 O:1"), stit_h2o)); @@ -51,8 +51,8 @@ TEST_F(SpeciesThermoInterpTypeTest, DISABLED_install_bad_pref) { // Currently broken because GeneralSpeciesThermo does not enforce reference // pressure consistency. - SpeciesThermoInterpType* stit_o2 = new ConstCpPoly(0, 200, 5000, 101325, c_o2); - SpeciesThermoInterpType* stit_h2 = new ConstCpPoly(1, 200, 5000, 100000, c_h2); + SpeciesThermoInterpType* stit_o2 = new ConstCpPoly(200, 5000, 101325, c_o2); + SpeciesThermoInterpType* stit_h2 = new ConstCpPoly(200, 5000, 100000, c_h2); p.addSpecies(Species("O2", parseCompString("O:2"), stit_o2)); // Pref does not match ASSERT_THROW(p.addSpecies(Species("H2", parseCompString("H:2"), stit_h2)), CanteraError); @@ -63,9 +63,9 @@ TEST_F(SpeciesThermoInterpTypeTest, install_nasa) { // Compare against instantiation from CTI file IdealGasPhase p2("../data/simplephases.cti", "nasa1"); - SpeciesThermoInterpType* stit_o2 = new NasaPoly2(0, 200, 3500, 101325, o2_nasa_coeffs); - SpeciesThermoInterpType* stit_h2 = new NasaPoly2(1, 200, 3500, 101325, h2_nasa_coeffs); - SpeciesThermoInterpType* stit_h2o = new NasaPoly2(2, 200, 3500, 101325, h2o_nasa_coeffs); + SpeciesThermoInterpType* stit_o2 = new NasaPoly2(200, 3500, 101325, o2_nasa_coeffs); + SpeciesThermoInterpType* stit_h2 = new NasaPoly2(200, 3500, 101325, h2_nasa_coeffs); + SpeciesThermoInterpType* stit_h2o = new NasaPoly2(200, 3500, 101325, h2o_nasa_coeffs); p.addSpecies(Species("O2", parseCompString("O:2"), stit_o2)); p.addSpecies(Species("H2", parseCompString("H:2"), stit_h2)); p.addSpecies(Species("H2O", parseCompString("H:2 O:1"), stit_h2o)); @@ -82,8 +82,8 @@ TEST_F(SpeciesThermoInterpTypeTest, install_shomate) { // Compare against instantiation from CTI file IdealGasPhase p2("../data/simplephases.cti", "shomate1"); - SpeciesThermoInterpType* stit_co = new ShomatePoly2(0, 200, 6000, 101325, co_shomate_coeffs); - SpeciesThermoInterpType* stit_co2 = new ShomatePoly2(1, 200, 6000, 101325, co2_shomate_coeffs); + SpeciesThermoInterpType* stit_co = new ShomatePoly2(200, 6000, 101325, co_shomate_coeffs); + SpeciesThermoInterpType* stit_co2 = new ShomatePoly2(200, 6000, 101325, co2_shomate_coeffs); p.addSpecies(Species("CO", parseCompString("C:1 O:1"), stit_co)); p.addSpecies(Species("CO2", parseCompString("C:1 O:2"), stit_co2)); p.initThermo(); diff --git a/test/thermo/thermo_data.h b/test/thermo/thermo_data.h index 3fed38c2c..6479a9207 100644 --- a/test/thermo/thermo_data.h +++ b/test/thermo/thermo_data.h @@ -1,33 +1,32 @@ namespace { -// 2-region NASA coefficients; Order is significantly different from the -// standard NASA format. +// 2-region NASA coefficients const double h2o_nasa_coeffs[] = { - 1000.0, -3.029372670E+04, -8.490322080E-01, 4.198640560E+00, - -2.036434100E-03, 6.520402110E-06, -5.487970620E-09, 1.771978170E-12, - -3.000429710E+04, 4.966770100E+00, 3.033992490E+00, 2.176918040E-03, - -1.640725180E-07, -9.704198700E-11, 1.682009920E-14}; + 1000.0, 3.03399249E+00, 2.17691804E-03, -1.64072518E-07, + -9.70419870E-11, 1.68200992E-14, -3.00042971E+04, 4.96677010E+00, + 4.19864056E+00, -2.03643410E-03, 6.52040211E-06, -5.48797062E-09, + 1.77197817E-12, -3.02937267E+04, -8.49032208E-01}; const double h2o_comp[] = {2.0, 1.0, 0.0}; const double h2_nasa_coeffs[] = { - 1000.0, -9.17935173E+02, 6.83010238E-01, 2.34433112E+00, - 7.98052075E-03, -1.94781510E-05, 2.01572094E-08, -7.37611761E-12, - -9.50158922E+02, -3.20502331E+00, 3.33727920E+00, -4.94024731E-05, - 4.99456778E-07, -1.79566394E-10, 2.00255376E-14}; + 1000.0, 3.33727920E+00, -4.94024731E-05, 4.99456778E-07, + -1.79566394E-10, 2.00255376E-14, -9.50158922E+02, -3.20502331E+00, + 2.34433112E+00, 7.98052075E-03, -1.94781510E-05, 2.01572094E-08, + -7.37611761E-12, -9.17935173E+02, 6.83010238E-01}; const double h2_comp[] = {2.0, 0.0, 0.0}; const double o2_nasa_coeffs[] = { - 1000.0, -1.063943560E+03, 3.657675730E+00, 3.782456360E+00, - -2.996734160E-03, 9.847302010E-06, -9.681295090E-09, 3.243728370E-12, - -1.088457720E+03, 5.453231290E+00, 3.282537840E+00, 1.483087540E-03, - -7.579666690E-07, 2.094705550E-10, -2.167177940E-14}; + 1000.0, 3.28253784E+00, 1.48308754E-03, -7.57966669E-07, + 2.09470555E-10, -2.16717794E-14, -1.08845772E+03, 5.45323129E+00, + 3.78245636E+00, -2.99673416E-03, 9.84730201E-06, -9.68129509E-09, + 3.24372837E-12, -1.06394356E+03, 3.65767573E+00}; const double o2_comp[] = {0.0, 2.0, 0.0}; const double oh_nasa_coeffs[] = { - 1000.0, 3.615080560E+03, -1.039254580E-01, 3.992015430E+00, - -2.401317520E-03, 4.617938410E-06, -3.881133330E-09, 1.364114700E-12, - 3.858657000E+03, 4.476696100E+00, 3.092887670E+00, 5.484297160E-04, - 1.265052280E-07, -8.794615560E-11, 1.174123760E-14}; + 1000.0, 3.09288767E+00, 5.48429716E-04, 1.26505228E-07, + -8.79461556E-11, 1.17412376E-14, 3.85865700E+03, 4.47669610E+00, + 3.99201543E+00, -2.40131752E-03, 4.61793841E-06, -3.88113333E-09, + 1.36411470E-12, 3.61508056E+03, -1.03925458E-01}; const double oh_comp[] = {1.0, 1.0, 0.0}; // 2-region Shomate coefficients (from NIST Chemistry WebBook) diff --git a/test/transport/transportFromScratch.cpp b/test/transport/transportFromScratch.cpp index d34720729..bebadfd94 100644 --- a/test/transport/transportFromScratch.cpp +++ b/test/transport/transportFromScratch.cpp @@ -19,11 +19,11 @@ class TransportFromScratch : public testing::Test public: TransportFromScratch() : sH2("H2", parseCompString("H:2"), - new NasaPoly2(0, 200, 3500, 101325, h2_nasa_coeffs)) + new NasaPoly2(200, 3500, 101325, h2_nasa_coeffs)) , sO2("O2", parseCompString("O:2"), - new NasaPoly2(0, 200, 3500, 101325, o2_nasa_coeffs)) + new NasaPoly2(200, 3500, 101325, o2_nasa_coeffs)) , sH2O("H2O", parseCompString("H:2 O:1"), - new NasaPoly2(0, 200, 3500, 101325, h2o_nasa_coeffs)) + new NasaPoly2(200, 3500, 101325, h2o_nasa_coeffs)) , tH2(new GasTransportData()) , tO2(new GasTransportData()) , tH2O(new GasTransportData())