From 6ab225ebdf4e7dd6a8e211fef1acbe2e97717a11 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Sat, 14 Aug 2010 18:33:37 +0000 Subject: [PATCH] Changed the enum name from TransportPropertyList to TransportPropertyType --- Cantera/src/transport/LTPspecies.cpp | 81 +++++++++---------- Cantera/src/transport/LTPspecies.h | 26 +++--- .../src/transport/LiquidTranInteraction.cpp | 4 +- Cantera/src/transport/LiquidTranInteraction.h | 54 ++++++------- Cantera/src/transport/TransportFactory.cpp | 4 +- Cantera/src/transport/TransportFactory.h | 12 ++- 6 files changed, 87 insertions(+), 94 deletions(-) diff --git a/Cantera/src/transport/LTPspecies.cpp b/Cantera/src/transport/LTPspecies.cpp index de0325347..ba9bb020e 100644 --- a/Cantera/src/transport/LTPspecies.cpp +++ b/Cantera/src/transport/LTPspecies.cpp @@ -20,7 +20,7 @@ namespace Cantera { */ class LTPError : public CanteraError { public: - LTPError( std::string msg ) + LTPError(std::string msg) : CanteraError("LTPspecies", "error parsing transport data: " + msg + "\n") {} @@ -85,28 +85,28 @@ namespace Cantera { * \verbatim \endverbatim node and specifies a type of * transport property (like viscosity) */ - LTPspecies_Const::LTPspecies_Const( const XML_Node &propNode, + LTPspecies_Const::LTPspecies_Const(const XML_Node &propNode, std::string name, - TransportPropertyList tp_ind, - thermo_t* thermo ) : - LTPspecies( propNode, name, tp_ind, thermo) + TransportPropertyType tp_ind, + thermo_t* thermo) : + LTPspecies(propNode, name, tp_ind, thermo) { m_model = LTR_MODEL_CONSTANT; double A_k = getFloatCurrent(propNode, "toSI"); if (A_k > 0.0) { m_coeffs.push_back(A_k); - } else throw LTPError("negative or zero " + propNode.name() ); + } else throw LTPError("negative or zero " + propNode.name()); } //==================================================================================================================== // Copy constructor - LTPspecies_Const::LTPspecies_Const( const LTPspecies_Const &right ) + LTPspecies_Const::LTPspecies_Const(const LTPspecies_Const &right) : LTPspecies() { *this = right; //use assignment operator to do other work } //==================================================================================================================== // Assignment operator - LTPspecies_Const& LTPspecies_Const::operator=(const LTPspecies_Const& right ) + LTPspecies_Const& LTPspecies_Const::operator=(const LTPspecies_Const& right) { if (&right != this) { //LTPspecies::operator=(right); @@ -131,7 +131,7 @@ namespace Cantera { } //==================================================================================================================== // Return the (constant) value for this transport property - doublereal LTPspecies_Const::getSpeciesTransProp( ) { + doublereal LTPspecies_Const::getSpeciesTransProp() { return m_coeffs[0]; } //==================================================================================================================== @@ -142,11 +142,9 @@ namespace Cantera { * \verbatim \endverbatim node and specifies a type of * transport property (like viscosity) */ - LTPspecies_Arrhenius::LTPspecies_Arrhenius( const XML_Node &propNode, - std::string name, - TransportPropertyList tp_ind, - thermo_t* thermo ) : - LTPspecies( propNode, name, tp_ind, thermo) + LTPspecies_Arrhenius::LTPspecies_Arrhenius(const XML_Node &propNode, std::string name, + TransportPropertyType tp_ind, thermo_t* thermo) : + LTPspecies(propNode, name, tp_ind, thermo) { m_model = LTR_MODEL_ARRHENIUS; m_temp = 0.0; @@ -155,23 +153,23 @@ namespace Cantera { doublereal A_k, n_k, Tact_k; getArrhenius(propNode, A_k, n_k, Tact_k); if (A_k <= 0.0) { - throw LTPError("negative or zero " + propNode.name() ); + throw LTPError("negative or zero " + propNode.name()); } - m_coeffs.push_back( A_k ); - m_coeffs.push_back( n_k ); - m_coeffs.push_back( Tact_k ); - m_coeffs.push_back( log( A_k ) ); + m_coeffs.push_back(A_k); + m_coeffs.push_back(n_k); + m_coeffs.push_back(Tact_k); + m_coeffs.push_back(log(A_k)); } //==================================================================================================================== // Copy constructor - LTPspecies_Arrhenius::LTPspecies_Arrhenius( const LTPspecies_Arrhenius &right ) + LTPspecies_Arrhenius::LTPspecies_Arrhenius(const LTPspecies_Arrhenius &right) : LTPspecies() { *this = right; //use assignment operator to do other work } //==================================================================================================================== // Assignment operator - LTPspecies_Arrhenius& LTPspecies_Arrhenius::operator=(const LTPspecies_Arrhenius& right ) + LTPspecies_Arrhenius& LTPspecies_Arrhenius::operator=(const LTPspecies_Arrhenius& right) { if (&right != this) { // LTPspecies::operator=(right); @@ -206,7 +204,7 @@ namespace Cantera { * In general the Arrhenius expression is * * \f[ - * \mu = A T^n \exp( - E / R T ). + * \mu = A T^n \exp(- E / R T). * \f] * * Note that for viscosity, the convention is such that @@ -215,13 +213,13 @@ namespace Cantera { * the Arrhenius expression is * * \f[ - * \mu = A T^n \exp( + E / R T ). + * \mu = A T^n \exp(+ E / R T). * \f] * * Any temperature and composition dependence will be * adjusted internally according to the information provided. */ - doublereal LTPspecies_Arrhenius::getSpeciesTransProp( ) { + doublereal LTPspecies_Arrhenius::getSpeciesTransProp() { doublereal t = m_thermo->temperature(); //m_coeffs[0] holds A @@ -234,16 +232,14 @@ namespace Cantera { m_temp = t; m_logt = log(m_temp); //For viscosity the sign convention on positive activation energy is swithced - if ( m_property == TP_VISCOSITY ) + if (m_property == TP_VISCOSITY) m_logProp = m_coeffs[3] + m_coeffs[1] * m_logt + m_coeffs[2] / m_temp ; else m_logProp = m_coeffs[3] + m_coeffs[1] * m_logt - m_coeffs[2] / m_temp ; - m_prop = exp( m_logProp ); + m_prop = exp(m_logProp); } return m_prop; } - - //==================================================================================================================== // Construct an LTPspecies object for a liquid tranport property // expressed as a polynomial in temperature. @@ -252,11 +248,9 @@ namespace Cantera { * \verbatim \endverbatim node and specifies a type of * transport property (like viscosity) */ - LTPspecies_Poly::LTPspecies_Poly(const XML_Node &propNode, - std::string name, - TransportPropertyList tp_ind, - thermo_t* thermo ) : - LTPspecies( propNode, name, tp_ind, thermo) + LTPspecies_Poly::LTPspecies_Poly(const XML_Node &propNode, std::string name, + TransportPropertyType tp_ind, thermo_t* thermo) : + LTPspecies(propNode, name, tp_ind, thermo) { m_model = LTR_MODEL_POLY; m_temp = 0.0; @@ -266,19 +260,19 @@ namespace Cantera { getFloatArray(propNode, m_coeffs, "true", "toSI"); /* if (m_coeffs[0] <= 0.0) { - throw LTPError("negative or zero " + propNode.name() ); + throw LTPError("negative or zero " + propNode.name()); }*/ } //==================================================================================================================== // Copy constructor - LTPspecies_Poly::LTPspecies_Poly( const LTPspecies_Poly &right ) + LTPspecies_Poly::LTPspecies_Poly(const LTPspecies_Poly &right) : LTPspecies() { *this = right; //use assignment operator to do other work } //==================================================================================================================== // Assignment operator - LTPspecies_Poly& LTPspecies_Poly::operator=(const LTPspecies_Poly& right ) + LTPspecies_Poly& LTPspecies_Poly::operator=(const LTPspecies_Poly& right) { if (&right != this) { //LTPspecies::operator=(right); @@ -307,7 +301,7 @@ namespace Cantera { //==================================================================================================================== // Return the value for this transport property evaluated // from the polynomial expression - doublereal LTPspecies_Poly::getSpeciesTransProp( ) { + doublereal LTPspecies_Poly::getSpeciesTransProp() { doublereal t = m_thermo->temperature(); if (t != m_temp) { @@ -331,9 +325,7 @@ namespace Cantera { * \verbatim \endverbatim node and specifies a type of * transport property (like viscosity) */ - LTPspecies_ExpT::LTPspecies_ExpT(const XML_Node &propNode, - std::string name, - TransportPropertyList tp_ind, + LTPspecies_ExpT::LTPspecies_ExpT(const XML_Node &propNode, std::string name, TransportPropertyType tp_ind, thermo_t* thermo) : LTPspecies(propNode, name, tp_ind, thermo) { @@ -343,19 +335,19 @@ namespace Cantera { getFloatArray(propNode, m_coeffs, "true", "toSI"); /* if (m_coeffs[0] <= 0.0) { - throw LTPError("negative or zero " + propNode.name() ); + throw LTPError("negative or zero " + propNode.name()); }*/ } //==================================================================================================================== // Copy constructor - LTPspecies_ExpT::LTPspecies_ExpT( const LTPspecies_ExpT &right ) + LTPspecies_ExpT::LTPspecies_ExpT(const LTPspecies_ExpT &right) : LTPspecies() { *this = right; //use assignment operator to do other work } //==================================================================================================================== // Assignment operator - LTPspecies_ExpT& LTPspecies_ExpT::operator=(const LTPspecies_ExpT& right ) + LTPspecies_ExpT& LTPspecies_ExpT::operator=(const LTPspecies_ExpT& right) { if (&right != this) { //LTPspecies::operator=(right); @@ -384,7 +376,7 @@ namespace Cantera { //==================================================================================================================== // Return the value for this transport property evaluated // from the exponential in temperature expression - doublereal LTPspecies_ExpT::getSpeciesTransProp( ) { + doublereal LTPspecies_ExpT::getSpeciesTransProp() { doublereal t = m_thermo->temperature(); if (t != m_temp) { @@ -395,7 +387,6 @@ namespace Cantera { for (int i = 1; i < (int) m_coeffs.size() ; i++) { tempN *= m_temp; m_prop *= exp(m_coeffs[i] * tempN); - //cout << "m_coeff = " < LTPptrs ) ; + doublereal getMixTransProp(doublereal *valueSpecies, doublereal *weightSpecies = 0 ); + doublereal getMixTransProp(std::vector LTPptrs) ; //! Return the matrix of binary interaction parameters. /** * Takes the proper mixing rule for the binary interaction parameters * and calculates them: Not implemented for this mixing rule. */ - void getMatrixTransProp( DenseMatrix &mat, doublereal* speciesValues = 0 ) { mat = (*m_Aij[0]); } + void getMatrixTransProp(DenseMatrix &mat, doublereal* speciesValues = 0 ) { mat = (*m_Aij[0]); } protected: @@ -368,7 +368,7 @@ namespace Cantera { class LTI_Log_MoleFracs : public LiquidTranInteraction { public: - LTI_Log_MoleFracs( TransportPropertyList tp_ind = TP_UNKNOWN ) : + LTI_Log_MoleFracs( TransportPropertyType tp_ind = TP_UNKNOWN ) : LiquidTranInteraction( tp_ind ) { m_model = LTI_MODEL_LOG_MOLEFRACS; @@ -389,15 +389,15 @@ namespace Cantera { * as input (this method does not know what * transport property it is at this point. */ - doublereal getMixTransProp( doublereal *valueSpecies, doublereal *weightSpecies = 0 ); - doublereal getMixTransProp( std::vector LTPptrs ) ; + doublereal getMixTransProp(doublereal *valueSpecies, doublereal *weightSpecies = 0 ); + doublereal getMixTransProp(std::vector LTPptrs ) ; //! Return the matrix of binary interaction parameters. /** * Takes the proper mixing rule for the binary interaction parameters * and calculates them: Not implemented for this mixing rule. */ - void getMatrixTransProp( DenseMatrix &mat, doublereal* speciesValues = 0 ) { mat = m_Eij; } + void getMatrixTransProp(DenseMatrix &mat, doublereal* speciesValues = 0 ) { mat = m_Eij; } protected: @@ -430,7 +430,7 @@ namespace Cantera { class LTI_Pairwise_Interaction : public LiquidTranInteraction { public: - LTI_Pairwise_Interaction( TransportPropertyList tp_ind = TP_UNKNOWN ) : + LTI_Pairwise_Interaction( TransportPropertyType tp_ind = TP_UNKNOWN ) : LiquidTranInteraction( tp_ind ) { m_model = LTI_MODEL_PAIRWISE_INTERACTION; @@ -541,8 +541,8 @@ namespace Cantera { class LTI_StefanMaxwell_PPN : public LiquidTranInteraction { public: - LTI_StefanMaxwell_PPN( TransportPropertyList tp_ind = TP_UNKNOWN ) : - LiquidTranInteraction( tp_ind ) + LTI_StefanMaxwell_PPN(TransportPropertyType tp_ind = TP_UNKNOWN) : + LiquidTranInteraction(tp_ind) { m_model = LTI_MODEL_STEFANMAXWELL_PPN; } @@ -556,7 +556,7 @@ namespace Cantera { virtual ~LTI_StefanMaxwell_PPN( ) { } - void setParameters( LiquidTransportParams& trParam ) ; + void setParameters(LiquidTransportParams& trParam ) ; //! Return the mixture transport property value. /** @@ -593,8 +593,8 @@ namespace Cantera { class LTI_StokesEinstein : public LiquidTranInteraction { public: - LTI_StokesEinstein( TransportPropertyList tp_ind = TP_UNKNOWN ) : - LiquidTranInteraction( tp_ind ) + LTI_StokesEinstein(TransportPropertyType tp_ind = TP_UNKNOWN) : + LiquidTranInteraction(tp_ind) { m_model = LTI_MODEL_STOKES_EINSTEIN; } @@ -608,7 +608,7 @@ namespace Cantera { virtual ~LTI_StokesEinstein( ) { } - void setParameters( LiquidTransportParams& trParam ); + void setParameters(LiquidTransportParams& trParam); //! Return the mixture transport property value. /** @@ -616,15 +616,15 @@ namespace Cantera { * as input (this method does not know what * transport property it is at this point. */ - doublereal getMixTransProp( doublereal *valueSpecies, doublereal *weightSpecies = 0 ); - doublereal getMixTransProp( std::vector LTPptrs ) ; + doublereal getMixTransProp(doublereal *valueSpecies, doublereal *weightSpecies = 0 ); + doublereal getMixTransProp(std::vector LTPptrs ) ; //! Return the matrix of binary interaction parameters. /** * Takes the proper mixing rule for the binary interaction parameters * and calculates them */ - void getMatrixTransProp( DenseMatrix &mat, doublereal* speciesValues = 0 ) ; + void getMatrixTransProp(DenseMatrix &mat, doublereal* speciesValues = 0 ) ; protected: std::vector m_viscosity; @@ -644,8 +644,8 @@ namespace Cantera { class LTI_MoleFracs_ExpT : public LiquidTranInteraction { public: - LTI_MoleFracs_ExpT( TransportPropertyList tp_ind = TP_UNKNOWN ) : - LiquidTranInteraction( tp_ind ) + LTI_MoleFracs_ExpT(TransportPropertyType tp_ind = TP_UNKNOWN) : + LiquidTranInteraction(tp_ind) { m_model = LTI_MODEL_MOLEFRACS_EXPT; } @@ -665,15 +665,15 @@ namespace Cantera { * as input (this method does not know what * transport property it is at this point. */ - doublereal getMixTransProp( doublereal *valueSpecies, doublereal *weightSpecies = 0 ); - doublereal getMixTransProp( std::vector LTPptrs ) ; + doublereal getMixTransProp(doublereal *valueSpecies, doublereal *weightSpecies = 0 ); + doublereal getMixTransProp(std::vector LTPptrs ) ; //! Return the matrix of binary interaction parameters. /** * Takes the proper mixing rule for the binary interaction parameters * and calculates them: Not Implemented for this mixing rule */ - void getMatrixTransProp( DenseMatrix &mat, doublereal* speciesValues = 0 ) { mat = (*m_Aij[0]); } + void getMatrixTransProp(DenseMatrix &mat, doublereal* speciesValues = 0 ) { mat = (*m_Aij[0]); } //CAL void getMatrixTransProp( DenseMatrix &mat, LiquidTransport* lt, doublereal* speciesValues = 0 ) { mat = (*m_Aij[0]); } protected: diff --git a/Cantera/src/transport/TransportFactory.cpp b/Cantera/src/transport/TransportFactory.cpp index 3bae891b5..b87cdad0c 100644 --- a/Cantera/src/transport/TransportFactory.cpp +++ b/Cantera/src/transport/TransportFactory.cpp @@ -304,7 +304,7 @@ namespace Cantera { and possibly composition. */ LTPspecies* TransportFactory::newLTP(const XML_Node &trNode, std::string &name, - TransportPropertyList tp_ind, thermo_t* thermo) + TransportPropertyType tp_ind, thermo_t* thermo) { LTPspecies* ltps = 0; std::string model = lowercase(trNode["model"]); @@ -336,7 +336,7 @@ namespace Cantera { returned by newLTP */ LiquidTranInteraction* TransportFactory::newLTI(const XML_Node &trNode, - TransportPropertyList tp_ind, + TransportPropertyType tp_ind, LiquidTransportParams& trParam) { LiquidTranInteraction* lti = 0; diff --git a/Cantera/src/transport/TransportFactory.h b/Cantera/src/transport/TransportFactory.h index 7154ee5cf..ec6ccd973 100644 --- a/Cantera/src/transport/TransportFactory.h +++ b/Cantera/src/transport/TransportFactory.h @@ -147,7 +147,6 @@ namespace Cantera { //! Deletes the statically malloced instance. virtual void deleteFactory(); - /*! * Destructor * @@ -160,7 +159,6 @@ namespace Cantera { virtual ~TransportFactory(); - //! Make one of several transport models, and return a base class pointer to it. /*! * This method operates at the level of a single transport property as a function of temperature @@ -168,11 +166,11 @@ namespace Cantera { * * @param trNode XML node * @param name reference to the name - * @param tp_ind TransportPropertyList class + * @param tp_ind TransportPropertyType class * @param thermo Pointer to the %ThermoPhase class */ virtual LTPspecies* newLTP(const XML_Node &trNode, std::string &name, - TransportPropertyList tp_ind, thermo_t* thermo); + TransportPropertyType tp_ind, thermo_t* thermo); //! Factory function for the construction of new LiquidTranInteraction @@ -182,11 +180,11 @@ namespace Cantera { * transport properties are addressed by the LTPspecies returned by newLTP. * * @param trNode XML_Node containing the information for the interaction - * @param tp_ind TransportPropertylist object + * @param tp_ind TransportPropertyType object * @param trParam reference to the LiquidTransportParams object */ virtual LiquidTranInteraction* newLTI(const XML_Node &trNode, - TransportPropertyList tp_ind, + TransportPropertyType tp_ind, LiquidTransportParams& trParam); @@ -446,7 +444,7 @@ namespace Cantera { //! Mapping between between the string name //! for a transport property and the integer name. - std::map m_tranPropMap; + std::map m_tranPropMap; //! Mapping between between the string name for a //! species-specific transport property model and the integer name.