Changed the enum name from TransportPropertyList to TransportPropertyType

This commit is contained in:
Harry Moffat 2010-08-14 18:33:37 +00:00
parent 741d094065
commit 6ab225ebdf
6 changed files with 87 additions and 94 deletions

View file

@ -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 <transport> \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 <transport> \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 <transport> \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 <transport> \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 = " <<m_coeffs[i] << ", tempN = " << tempN << ", m_prop = " << m_prop << endl;
}
}
//cout << "m_prop = " << m_prop << endl;

View file

@ -33,13 +33,17 @@ namespace Cantera {
* should handle exceptions where the transport property is not handled.
*
* Tranport properties currently on the list
*
* 0 - viscosity
* 1 - thermal conductivity
* 2 - species diffusivity
* 3 - hydrodynamic radius
* 4 - thermal conductivity
* 1 - Ionic conductivity
* 2 - Mobility Ratio
* 3 - Self Diffusion coefficient
* 4 - Thermal conductivity
* 5 - species diffusivity
* 6 - hydrodynamic radius
* 7 - electrical conductivity
*/
enum TransportPropertyList {
enum TransportPropertyType {
TP_UNKNOWN = -1,
TP_VISCOSITY = 0,
TP_IONCONDUCTIVITY,
@ -91,7 +95,7 @@ namespace Cantera {
*/
LTPspecies(const XML_Node &propNode = 0,
std::string name = "-",
TransportPropertyList tp_ind = TP_UNKNOWN,
TransportPropertyType tp_ind = TP_UNKNOWN,
const thermo_t* const thermo = 0) :
m_speciesName(name),
m_model(LTR_MODEL_NOTSET),
@ -141,7 +145,7 @@ namespace Cantera {
LiquidTR_Model m_model;
//! enum indicating which property this is (i.e viscosity)
TransportPropertyList m_property;
TransportPropertyType m_property;
//! Model temperature-dependence ceofficients
vector_fp m_coeffs;
@ -206,7 +210,7 @@ namespace Cantera {
*/
LTPspecies_Const(const XML_Node &propNode,
std::string name,
TransportPropertyList tp_ind,
TransportPropertyType tp_ind,
thermo_t* thermo);
//! Copy constructor
@ -284,7 +288,7 @@ namespace Cantera {
*/
LTPspecies_Arrhenius( const XML_Node &propNode,
std::string name,
TransportPropertyList tp_ind,
TransportPropertyType tp_ind,
thermo_t* thermo );
//! Copy constructor
@ -386,7 +390,7 @@ namespace Cantera {
*/
LTPspecies_Poly( const XML_Node &propNode,
std::string name,
TransportPropertyList tp_ind,
TransportPropertyType tp_ind,
thermo_t* thermo );
//! Copy constructor
@ -469,7 +473,7 @@ namespace Cantera {
*/
LTPspecies_ExpT(const XML_Node &propNode,
std::string name,
TransportPropertyList tp_ind,
TransportPropertyType tp_ind,
thermo_t* thermo );
//! Copy constructor

View file

@ -48,7 +48,7 @@ namespace Cantera {
/*
* @param tp_ind Index indicating transport property type (i.e. viscosity)
*/
LiquidTranInteraction::LiquidTranInteraction(TransportPropertyList tp_ind ) :
LiquidTranInteraction::LiquidTranInteraction(TransportPropertyType tp_ind ) :
m_model(LTI_MODEL_NOTSET),
m_property(tp_ind)
{
@ -234,7 +234,7 @@ namespace Cantera {
//====================================================================================================================
LTI_Solvent::LTI_Solvent(TransportPropertyList tp_ind) :
LTI_Solvent::LTI_Solvent(TransportPropertyType tp_ind) :
LiquidTranInteraction(tp_ind)
{
m_model = LTI_MODEL_SOLVENT;

View file

@ -120,7 +120,7 @@ namespace Cantera {
/**
* @param tp_ind Index indicating transport property type (i.e. viscosity)
*/
LiquidTranInteraction(TransportPropertyList tp_ind = TP_UNKNOWN);
LiquidTranInteraction(TransportPropertyType tp_ind = TP_UNKNOWN);
//! Copy constructor
LiquidTranInteraction(const LiquidTranInteraction &right);
@ -162,7 +162,7 @@ namespace Cantera {
LiquidTranMixingModel m_model;
//! enum indicating what property this is (i.e viscosity)
TransportPropertyList m_property;
TransportPropertyType m_property;
//! pointer to thermo object to get current temperature
thermo_t* m_thermo;
@ -195,7 +195,7 @@ namespace Cantera {
class LTI_Solvent : public LiquidTranInteraction {
public:
LTI_Solvent(TransportPropertyList tp_ind = TP_UNKNOWN);
LTI_Solvent(TransportPropertyType tp_ind = TP_UNKNOWN);
//! Copy constructor
// LTI_Solvent( const LTI_Solvent &right );
@ -238,7 +238,7 @@ namespace Cantera {
class LTI_MoleFracs : public LiquidTranInteraction {
public:
LTI_MoleFracs( TransportPropertyList tp_ind = TP_UNKNOWN ) :
LTI_MoleFracs( TransportPropertyType tp_ind = TP_UNKNOWN ) :
LiquidTranInteraction( tp_ind )
{
m_model = LTI_MODEL_MOLEFRACS;
@ -289,7 +289,7 @@ namespace Cantera {
public:
LTI_MassFracs( TransportPropertyList tp_ind = TP_UNKNOWN ) :
LTI_MassFracs(TransportPropertyType tp_ind = TP_UNKNOWN) :
LiquidTranInteraction( tp_ind )
{
m_model = LTI_MODEL_MASSFRACS;
@ -310,15 +310,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<LTPspecies*> LTPptrs ) ;
doublereal getMixTransProp(doublereal *valueSpecies, doublereal *weightSpecies = 0 );
doublereal getMixTransProp(std::vector<LTPspecies*> 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<LTPspecies*> LTPptrs ) ;
doublereal getMixTransProp(doublereal *valueSpecies, doublereal *weightSpecies = 0 );
doublereal getMixTransProp(std::vector<LTPspecies*> 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<LTPspecies*> LTPptrs ) ;
doublereal getMixTransProp(doublereal *valueSpecies, doublereal *weightSpecies = 0 );
doublereal getMixTransProp(std::vector<LTPspecies*> 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<LTPspecies*> 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<LTPspecies*> LTPptrs ) ;
doublereal getMixTransProp(doublereal *valueSpecies, doublereal *weightSpecies = 0 );
doublereal getMixTransProp(std::vector<LTPspecies*> 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:

View file

@ -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;

View file

@ -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<std::string, TransportPropertyList> m_tranPropMap;
std::map<std::string, TransportPropertyType> m_tranPropMap;
//! Mapping between between the string name for a
//! species-specific transport property model and the integer name.