diff --git a/Cantera/src/thermo/AdsorbateThermo.h b/Cantera/src/thermo/AdsorbateThermo.h index 88457697e..1d8230ffd 100644 --- a/Cantera/src/thermo/AdsorbateThermo.h +++ b/Cantera/src/thermo/AdsorbateThermo.h @@ -8,9 +8,9 @@ * */ -/* $Author: dggoodwin $ - * $Revision: 1.2 $ - * $Date: 2007/12/24 15:32:30 $ +/* $Author$ + * $Revision$ + * $Date$ */ // Copyright 2007 California Institute of Technology diff --git a/Cantera/src/thermo/ConstCpPoly.cpp b/Cantera/src/thermo/ConstCpPoly.cpp index 868fafea9..2cfcd2a37 100644 --- a/Cantera/src/thermo/ConstCpPoly.cpp +++ b/Cantera/src/thermo/ConstCpPoly.cpp @@ -5,9 +5,9 @@ * \link Cantera::ConstCpPoly ConstCpPoly \endlink). */ /* - * $Author: hkmoffa $ - * $Revision: 1.3 $ - * $Date: 2008/12/17 17:04:46 $ + * $Author$ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/ConstCpPoly.h b/Cantera/src/thermo/ConstCpPoly.h index b46ccd8bb..7577769c5 100644 --- a/Cantera/src/thermo/ConstCpPoly.h +++ b/Cantera/src/thermo/ConstCpPoly.h @@ -5,9 +5,9 @@ * \link Cantera::ConstCpPoly ConstCpPoly\endlink). */ /* - * $Author: hkmoffa $ - * $Revision: 1.3 $ - * $Date: 2008/12/13 01:59:49 $ + * $Author$ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/ConstDensityThermo.cpp b/Cantera/src/thermo/ConstDensityThermo.cpp index a8d442957..b0adfaca1 100755 --- a/Cantera/src/thermo/ConstDensityThermo.cpp +++ b/Cantera/src/thermo/ConstDensityThermo.cpp @@ -5,7 +5,7 @@ \endlink). */ /* - * $Id: ConstDensityThermo.cpp,v 1.5 2008/12/17 17:04:47 hkmoffa Exp $ + * $Id$ * * Copyright 2002 California Institute of Technology */ diff --git a/Cantera/src/thermo/ConstDensityThermo.h b/Cantera/src/thermo/ConstDensityThermo.h index 809323156..f462516c5 100755 --- a/Cantera/src/thermo/ConstDensityThermo.h +++ b/Cantera/src/thermo/ConstDensityThermo.h @@ -4,9 +4,9 @@ * (see \ref thermoprops and \link Cantera::ConstDensityThermo ConstDensityThermo\endlink). */ /* - * $Author: hkmoffa $ - * $Date: 2008/12/10 16:42:48 $ - * $Revision: 1.5 $ + * $Author$ + * $Date$ + * $Revision$ * * Copyright 2002 California Institute of Technology * diff --git a/Cantera/src/thermo/Constituents.cpp b/Cantera/src/thermo/Constituents.cpp index 54a9e220f..2d42d9564 100755 --- a/Cantera/src/thermo/Constituents.cpp +++ b/Cantera/src/thermo/Constituents.cpp @@ -5,8 +5,8 @@ */ /* - * $Date: 2009/01/04 21:28:02 $ - * $Revision: 1.7 $ + * $Date$ + * $Revision$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/Constituents.h b/Cantera/src/thermo/Constituents.h index e386ee935..a38622906 100755 --- a/Cantera/src/thermo/Constituents.h +++ b/Cantera/src/thermo/Constituents.h @@ -5,8 +5,8 @@ */ /* - * $Date: 2009/02/23 20:41:03 $ - * $Revision: 1.7 $ + * $Date$ + * $Revision$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/Crystal.h b/Cantera/src/thermo/Crystal.h index efe4a8c3b..3e6652137 100644 --- a/Cantera/src/thermo/Crystal.h +++ b/Cantera/src/thermo/Crystal.h @@ -1,9 +1,9 @@ /** * @file Crystal.h * - * $Author: dggoodwin $ - * $Date: 2007/05/04 14:02:40 $ - * $Revision: 1.1 $ + * $Author$ + * $Date$ + * $Revision$ */ #ifndef CT_CRYSTAL_H #define CT_CRYSTAL_H diff --git a/Cantera/src/thermo/DebyeHuckel.cpp b/Cantera/src/thermo/DebyeHuckel.cpp index 9c4d78919..91546cf6d 100644 --- a/Cantera/src/thermo/DebyeHuckel.cpp +++ b/Cantera/src/thermo/DebyeHuckel.cpp @@ -13,7 +13,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: DebyeHuckel.cpp,v 1.33 2009/03/27 00:38:56 hkmoffa Exp $ + * $Id$ */ //! Max function #ifndef MAX diff --git a/Cantera/src/thermo/DebyeHuckel.h b/Cantera/src/thermo/DebyeHuckel.h index 1467ec860..16e3b5dc8 100644 --- a/Cantera/src/thermo/DebyeHuckel.h +++ b/Cantera/src/thermo/DebyeHuckel.h @@ -15,7 +15,7 @@ */ /* - * $Id: DebyeHuckel.h,v 1.31 2009/03/27 00:38:57 hkmoffa Exp $ + * $Id$ */ #ifndef CT_DEBYEHUCKEL_H diff --git a/Cantera/src/thermo/EdgePhase.h b/Cantera/src/thermo/EdgePhase.h index 8acafc6bf..176e9afb8 100644 --- a/Cantera/src/thermo/EdgePhase.h +++ b/Cantera/src/thermo/EdgePhase.h @@ -4,9 +4,9 @@ * between two surfaces (see \ref thermoprops and \link Cantera::EdgePhase EdgePhase\endlink). */ -/* $Author: hkmoffa $ - * $Date: 2008/10/08 22:11:08 $ - * $Revision: 1.3 $ +/* $Author$ + * $Date$ + * $Revision$ * * Copyright 2002 California Institute of Technology * diff --git a/Cantera/src/thermo/Elements.cpp b/Cantera/src/thermo/Elements.cpp index 073e3c443..61e4a260b 100644 --- a/Cantera/src/thermo/Elements.cpp +++ b/Cantera/src/thermo/Elements.cpp @@ -9,9 +9,9 @@ /**************************************************************************** * $RCSfile: Elements.cpp,v $ - * $Author: hkmoffa $ - * $Date: 2009/03/13 03:21:34 $ - * $Revision: 1.7 $ + * $Author$ + * $Date$ + * $Revision$ * * ****************************************************************************/ diff --git a/Cantera/src/thermo/Elements.h b/Cantera/src/thermo/Elements.h index 298450eb3..148cf2abf 100644 --- a/Cantera/src/thermo/Elements.h +++ b/Cantera/src/thermo/Elements.h @@ -7,9 +7,9 @@ */ /*********************************************************************** * $RCSfile: Elements.h,v $ - * $Author: hkmoffa $ - * $Date: 2008/12/04 02:02:45 $ - * $Revision: 1.5 $ + * $Author$ + * $Date$ + * $Revision$ ***********************************************************************/ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/GeneralSpeciesThermo.cpp b/Cantera/src/thermo/GeneralSpeciesThermo.cpp index 683ae3c74..b96fd7bbe 100644 --- a/Cantera/src/thermo/GeneralSpeciesThermo.cpp +++ b/Cantera/src/thermo/GeneralSpeciesThermo.cpp @@ -5,7 +5,7 @@ * \link Cantera::GeneralSpeciesThermo GeneralSpeciesThermo\endlink). */ /* - * $Id: GeneralSpeciesThermo.cpp,v 1.10 2008/12/13 01:59:49 hkmoffa Exp $ + * $Id$ */ // Copyright 2001-2004 California Institute of Technology diff --git a/Cantera/src/thermo/GeneralSpeciesThermo.h b/Cantera/src/thermo/GeneralSpeciesThermo.h index 4cbe211f3..0697d7e9d 100644 --- a/Cantera/src/thermo/GeneralSpeciesThermo.h +++ b/Cantera/src/thermo/GeneralSpeciesThermo.h @@ -8,9 +8,9 @@ */ /* - * $Author: hkmoffa $ - * $Revision: 1.7 $ - * $Date: 2008/12/13 01:59:49 $ + * $Author$ + * $Revision$ + * $Date$ */ #ifndef CT_GENERALSPECIESTHERMO_H diff --git a/Cantera/src/thermo/GibbsExcessVPSSTP.cpp b/Cantera/src/thermo/GibbsExcessVPSSTP.cpp index 6958d2b6b..fd7e460c3 100644 --- a/Cantera/src/thermo/GibbsExcessVPSSTP.cpp +++ b/Cantera/src/thermo/GibbsExcessVPSSTP.cpp @@ -17,8 +17,8 @@ * U.S. Government retains certain rights in this software. */ /* - * $Date: 2009/03/03 21:08:31 $ - * $Revision: 1.3 $ + * $Date$ + * $Revision$ */ @@ -45,7 +45,7 @@ namespace Cantera { GibbsExcessVPSSTP::GibbsExcessVPSSTP(const GibbsExcessVPSSTP &b) : VPStandardStateTP() { - *this = operator=(b); + GibbsExcessVPSSTP::operator=(b); } /* @@ -56,13 +56,16 @@ namespace Cantera { */ GibbsExcessVPSSTP& GibbsExcessVPSSTP:: operator=(const GibbsExcessVPSSTP &b) { - if (&b != this) { - VPStandardStateTP::operator=(b); + if (&b == this) { + return *this; } + VPStandardStateTP::operator=(b); + moleFractions_ = b.moleFractions_; lnActCoeff_Scaled_ = b.lnActCoeff_Scaled_; dlnActCoeffdT_Scaled_ = b.dlnActCoeffdT_Scaled_; + dlnActCoeffdlnC_Scaled_ = b.dlnActCoeffdlnC_Scaled_; m_pp = b.m_pp; return *this; @@ -93,33 +96,21 @@ namespace Cantera { */ void GibbsExcessVPSSTP::setMassFractions(const doublereal* const y) { -#if DEBUG_MODE - checkMFSum(y); -#endif State::setMassFractions(y); getMoleFractions(DATA_PTR(moleFractions_)); } void GibbsExcessVPSSTP::setMassFractions_NoNorm(const doublereal* const y) { -#if DEBUG_MODE - checkMFSum(y); -#endif State::setMassFractions_NoNorm(y); getMoleFractions(DATA_PTR(moleFractions_)); } void GibbsExcessVPSSTP::setMoleFractions(const doublereal* const x) { -#if DEBUG_MODE - checkMFSum(x); -#endif State::setMoleFractions(x); getMoleFractions(DATA_PTR(moleFractions_)); } void GibbsExcessVPSSTP::setMoleFractions_NoNorm(const doublereal* const x) { -#if DEBUG_MODE - checkMFSum(x); -#endif State::setMoleFractions_NoNorm(x); getMoleFractions(DATA_PTR(moleFractions_)); } @@ -257,21 +248,13 @@ namespace Cantera { return 0; } - //@} - /// @name Properties of the Standard State of the Species in the Solution - //@{ - - - - //@} - /// @name Thermodynamic Values for the Species Reference States - //@{ + double GibbsExcessVPSSTP::checkMFSum(const doublereal * const x) const { doublereal norm = accumulate(x, x + m_kk, 0.0); if (fabs(norm - 1.0) > 1.0E-9) { - throw CanteraError("GibbsExcessVPSSTP::checkMFSun", - "MF sum exceeded tolerance of 1.0E-9:" + fp2str(norm)); + throw CanteraError("GibbsExcessVPSSTP::checkMFSum", + "(MF sum - 1) exceeded tolerance of 1.0E-9:" + fp2str(norm)); } return norm; } @@ -337,6 +320,7 @@ namespace Cantera { moleFractions_.resize(m_kk); lnActCoeff_Scaled_.resize(m_kk); dlnActCoeffdT_Scaled_.resize(m_kk); + dlnActCoeffdlnC_Scaled_.resize(m_kk); m_pp.resize(m_kk); } diff --git a/Cantera/src/thermo/GibbsExcessVPSSTP.h b/Cantera/src/thermo/GibbsExcessVPSSTP.h index 75242aec8..185c2be27 100644 --- a/Cantera/src/thermo/GibbsExcessVPSSTP.h +++ b/Cantera/src/thermo/GibbsExcessVPSSTP.h @@ -1,9 +1,9 @@ /** - * @file gibbsExcessVPSSTP.h + * @file GibbsExcessVPSSTP.h * Header for intermediate ThermoPhase object for phases which * employ gibbs excess free energy based formulations * (see \ref thermoprops - * and class \link Cantera::gibbsExcessVPSSTP gibbsExcessVPSSTP\endlink). + * and class \link Cantera::GibbsExcessVPSSTP GibbsExcessVPSSTP\endlink). * * Header file for a derived class of ThermoPhase that handles * variable pressure standard state methods for calculating @@ -17,7 +17,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: GibbsExcessVPSSTP.h,v 1.3 2009/03/03 21:08:31 hkmoffa Exp $ + * $Id$ */ #ifndef CT_GIBBSEXCESSVPSSTP_H @@ -302,6 +302,28 @@ namespace Cantera { err("getdlnActCoeffdT"); } + //! Get the array of log concentration-like derivatives of the + //! log activity coefficients + /*! + * This function is a virtual method. For ideal mixtures + * (unity activity coefficients), this can return zero. + * Implementations should take the derivative of the + * logarithm of the activity coefficient with respect to the + * logarithm of the concentration-like variable (i.e. mole fraction, + * molality, etc.) that represents the standard state. + * This quantity is to be used in conjunction with derivatives of + * that concentration-like variable when the derivative of the chemical + * potential is taken. + * + * units = dimensionless + * + * @param dlnActCoeffdlnC Output vector of derivatives of the + * log Activity Coefficients. length = m_kk + */ + virtual void getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const { + err("getdlnActCoeffdlnC"); + } + //@} /// @name Partial Molar Properties of the Solution //@{ @@ -517,6 +539,10 @@ namespace Cantera { protected: + //! utility routine to check mole fraction sum + /*! + * @param x vector of mole fractions. + */ double checkMFSum(const doublereal * const x) const; protected: @@ -528,10 +554,16 @@ namespace Cantera { //! species, divided by RT mutable std::vector lnActCoeff_Scaled_; - //! Storage for the current derivative values of the log of the - // activity coefficients of the species + //! Storage for the current derivative values of the + //! gradients with respect to temperature of the + //! log of theactivity coefficients of the species mutable std::vector dlnActCoeffdT_Scaled_; + //! Storage for the current derivative values of the + //! gradients with respect to logarithm of the mole fraction of the + //! log of theactivity coefficients of the species + mutable std::vector dlnActCoeffdlnC_Scaled_; + //! Temporary storage space that is fair game mutable std::vector m_pp; diff --git a/Cantera/src/thermo/HMWSoln.cpp b/Cantera/src/thermo/HMWSoln.cpp index c221ab0cf..073eeaddf 100644 --- a/Cantera/src/thermo/HMWSoln.cpp +++ b/Cantera/src/thermo/HMWSoln.cpp @@ -18,7 +18,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: HMWSoln.cpp,v 1.53 2009/03/27 00:38:57 hkmoffa Exp $ + * $Id$ */ //@{ #ifndef MAX diff --git a/Cantera/src/thermo/HMWSoln.h b/Cantera/src/thermo/HMWSoln.h index 7c55e8ab4..40cce6f86 100644 --- a/Cantera/src/thermo/HMWSoln.h +++ b/Cantera/src/thermo/HMWSoln.h @@ -14,7 +14,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: HMWSoln.h,v 1.62 2009/03/27 00:38:57 hkmoffa Exp $ + * $Id$ */ #ifndef CT_HMWSOLN_H @@ -104,7 +104,7 @@ namespace Cantera { * water (IAPWS 1995 formulation) is used as its standard state. * All standard state properties for the solvent are based on * this real model for water, and involve function calls - * to the object that handles the real water model, #WaterPropsIAPWS. + * to the object that handles the real water model, #Cantera::WaterPropsIAPWS. * * The standard states for solutes are on the unit molality basis. * Therefore, in the documentation below, the normal \f$ o \f$ @@ -507,7 +507,7 @@ namespace Cantera { * \f] * * - *

Activity of the Water Solvent

+ *

Activity of the Water Solvent

* * The activity for the solvent water,\f$ a_o \f$, is not independent and must be * determined either from the Gibbs-Duhem relation or from taking the appropriate derivative diff --git a/Cantera/src/thermo/HMWSoln_input.cpp b/Cantera/src/thermo/HMWSoln_input.cpp index 534684626..bca1ae93f 100644 --- a/Cantera/src/thermo/HMWSoln_input.cpp +++ b/Cantera/src/thermo/HMWSoln_input.cpp @@ -13,7 +13,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: HMWSoln_input.cpp,v 1.33 2009/01/29 02:07:05 hkmoffa Exp $ + * $Id$ */ #include "HMWSoln.h" diff --git a/Cantera/src/thermo/IdealGasPhase.cpp b/Cantera/src/thermo/IdealGasPhase.cpp index a07107628..b442f540b 100644 --- a/Cantera/src/thermo/IdealGasPhase.cpp +++ b/Cantera/src/thermo/IdealGasPhase.cpp @@ -7,7 +7,7 @@ * */ /* - * $Id: IdealGasPhase.cpp,v 1.3 2008/08/23 00:53:54 hkmoffa Exp $ + * $Id$ */ #ifdef WIN32 diff --git a/Cantera/src/thermo/IdealGasPhase.h b/Cantera/src/thermo/IdealGasPhase.h index c9d069943..cc676a8a4 100644 --- a/Cantera/src/thermo/IdealGasPhase.h +++ b/Cantera/src/thermo/IdealGasPhase.h @@ -6,9 +6,9 @@ * */ -/* $Author: hkmoffa $ - * $Date: 2009/07/05 18:07:18 $ - * $Revision: 1.5 $ +/* $Author$ + * $Date$ + * $Revision$ * * Copyright 2001 California Institute of Technology * diff --git a/Cantera/src/thermo/IdealMolalSoln.cpp b/Cantera/src/thermo/IdealMolalSoln.cpp index 280e0060a..0c560636a 100644 --- a/Cantera/src/thermo/IdealMolalSoln.cpp +++ b/Cantera/src/thermo/IdealMolalSoln.cpp @@ -19,8 +19,8 @@ */ /* * - * $Date: 2009/03/27 00:51:38 $ - * $Revision: 1.27 $ + * $Date$ + * $Revision$ */ #include "IdealMolalSoln.h" diff --git a/Cantera/src/thermo/IdealMolalSoln.h b/Cantera/src/thermo/IdealMolalSoln.h index 4a5118762..737fe349a 100644 --- a/Cantera/src/thermo/IdealMolalSoln.h +++ b/Cantera/src/thermo/IdealMolalSoln.h @@ -19,9 +19,9 @@ * U.S. Government retains certain rights in this software. */ /* - * $Author: hkmoffa $ - * $Date: 2009/03/27 00:51:38 $ - * $Revision: 1.24 $ + * $Author$ + * $Date$ + * $Revision$ */ #ifndef CT_IDEALMOLALSOLN_H diff --git a/Cantera/src/thermo/IdealSolidSolnPhase.cpp b/Cantera/src/thermo/IdealSolidSolnPhase.cpp index 5ca849645..ccc8aa17b 100644 --- a/Cantera/src/thermo/IdealSolidSolnPhase.cpp +++ b/Cantera/src/thermo/IdealSolidSolnPhase.cpp @@ -5,7 +5,7 @@ * \link Cantera::IdealSolidSolnPhase IdealSolidSolnPhase\endlink). */ /* - * $Id: IdealSolidSolnPhase.cpp,v 1.11 2009/03/27 00:51:39 hkmoffa Exp $ + * $Id$ */ /* * Copywrite 2006 Sandia Corporation. Under the terms of Contract diff --git a/Cantera/src/thermo/IdealSolidSolnPhase.h b/Cantera/src/thermo/IdealSolidSolnPhase.h index 77df55a8d..a9f87b29c 100644 --- a/Cantera/src/thermo/IdealSolidSolnPhase.h +++ b/Cantera/src/thermo/IdealSolidSolnPhase.h @@ -10,9 +10,9 @@ */ /* - * $Author: hkmoffa $ - * $Date: 2009/03/27 00:51:39 $ - * $Revision: 1.18 $ + * $Author$ + * $Date$ + * $Revision$ */ /* * Copywrite 2006 Sandia Corporation. Under the terms of Contract diff --git a/Cantera/src/thermo/IdealSolnGasVPSS.cpp b/Cantera/src/thermo/IdealSolnGasVPSS.cpp index 308d5f612..a3943247b 100644 --- a/Cantera/src/thermo/IdealSolnGasVPSS.cpp +++ b/Cantera/src/thermo/IdealSolnGasVPSS.cpp @@ -12,9 +12,9 @@ * U.S. Government retains certain rights in this software. */ /* - * $Author: hkmoffa $ - * $Date: 2008/09/16 14:38:13 $ - * $Revision: 1.2 $ + * $Author$ + * $Date$ + * $Revision$ */ // turn off warnings under Windows diff --git a/Cantera/src/thermo/IdealSolnGasVPSS.h b/Cantera/src/thermo/IdealSolnGasVPSS.h index be8623de0..4be4e7a09 100644 --- a/Cantera/src/thermo/IdealSolnGasVPSS.h +++ b/Cantera/src/thermo/IdealSolnGasVPSS.h @@ -12,9 +12,9 @@ * U.S. Government retains certain rights in this software. */ /* - * $Author: hkmoffa $ - * $Date: 2008/08/23 00:53:54 $ - * $Revision: 1.1 $ + * $Author$ + * $Date$ + * $Revision$ */ #ifndef CT_IDEALSOLNGASVPSS_H diff --git a/Cantera/src/thermo/IonsFromNeutralVPSSTP.cpp b/Cantera/src/thermo/IonsFromNeutralVPSSTP.cpp index 93dd6402f..aaa88fe7c 100644 --- a/Cantera/src/thermo/IonsFromNeutralVPSSTP.cpp +++ b/Cantera/src/thermo/IonsFromNeutralVPSSTP.cpp @@ -1,9 +1,9 @@ /** - * @file PseudoBinaryVPSSTP.cpp - * Definitions for intermediate ThermoPhase object for phases which - * employ excess gibbs free energy formulations + * @file IonsFromNeutralVPSSTP.cpp + * Definitions for the object which treats ionic liquids as made of ions as species + * even though the thermodynamics is obtained from the neutral molecule representation. * (see \ref thermoprops - * and class \link Cantera::PseudoBinaryVPSSTP PseudoBinaryVPSSTP\endlink). + * and class \link Cantera::IonsFromNeutralVPSSTP IonsFromNeutralVPSSTP\endlink). * * Header file for a derived class of ThermoPhase that handles * variable pressure standard state methods for calculating @@ -17,11 +17,10 @@ * U.S. Government retains certain rights in this software. */ /* - * $Date: 2009/03/27 01:08:55 $ - * $Revision: 1.2 $ + * $Date$ + * $Revision$ */ - #include "IonsFromNeutralVPSSTP.h" #include "ThermoFactory.h" @@ -142,7 +141,7 @@ namespace Cantera { neutralMoleculePhase_(0), IOwnNThermoPhase_(true) { - *this = operator=(b); + IonsFromNeutralVPSSTP::operator=(b); } /* @@ -153,14 +152,38 @@ namespace Cantera { */ IonsFromNeutralVPSSTP& IonsFromNeutralVPSSTP:: operator=(const IonsFromNeutralVPSSTP &b) { - if (&b != this) { - GibbsExcessVPSSTP::operator=(b); - } + if (&b == this) { + return *this; + } + + /* + * If we own the underlying neutral molecule phase, then we do a deep + * copy. If not, we do a shallow copy. We get a valid pointer for + * neutralMoleculePhase_ first, because we need it to assign the pointers + * within the PDSS_IonsFromNeutral object. which is done in the + * GibbsExcessVPSSTP::operator=(b) step. + */ + if (IOwnNThermoPhase_) { + if (b.neutralMoleculePhase_) { + if (neutralMoleculePhase_) { + delete neutralMoleculePhase_; + } + neutralMoleculePhase_ = (b.neutralMoleculePhase_)->duplMyselfAsThermoPhase(); + } else { + neutralMoleculePhase_ = 0; + } + } else { + neutralMoleculePhase_ = b.neutralMoleculePhase_; + } + + GibbsExcessVPSSTP::operator=(b); ionSolnType_ = b.ionSolnType_; numNeutralMoleculeSpecies_ = b.numNeutralMoleculeSpecies_; indexSpecialSpecies_ = b.indexSpecialSpecies_; indexSecondSpecialSpecies_ = b.indexSecondSpecialSpecies_; + fm_neutralMolec_ions_ = b.fm_neutralMolec_ions_; + fm_invert_ionForNeutral = b.fm_invert_ionForNeutral; NeutralMolecMoleFractions_ = b.NeutralMolecMoleFractions_; cationList_ = b.cationList_; numCationSpecies_ = b.numCationSpecies_; @@ -168,21 +191,18 @@ namespace Cantera { numAnionSpecies_ = b.numAnionSpecies_; passThroughList_ = b.passThroughList_; numPassThroughSpecies_ = b.numPassThroughSpecies_; - /* - * This is a shallow copy. We need to figure this out - */ - neutralMoleculePhase_ = b.neutralMoleculePhase_; - if (neutralMoleculePhase_) { - exit(-1); - } - IOwnNThermoPhase_ = b.IOwnNThermoPhase_; + IOwnNThermoPhase_ = b.IOwnNThermoPhase_; moleFractionsTmp_ = b.moleFractionsTmp_; + muNeutralMolecule_ = b.muNeutralMolecule_; + gammaNeutralMolecule_ = b.gammaNeutralMolecule_; + dlnActCoeffdT_NeutralMolecule_ = b.dlnActCoeffdT_NeutralMolecule_; + dlnActCoeffdlnC_NeutralMolecule_ = b.dlnActCoeffdlnC_NeutralMolecule_; return *this; } - /** + /* * * ~IonsFromNeutralVPSSTP(): (virtual) * @@ -192,7 +212,7 @@ namespace Cantera { IonsFromNeutralVPSSTP::~IonsFromNeutralVPSSTP() { if (IOwnNThermoPhase_) { delete neutralMoleculePhase_; - neutralMoleculePhase_=0; + neutralMoleculePhase_ = 0; } } @@ -563,6 +583,37 @@ namespace Cantera { } + //! Get the array of log concentration-like derivatives of the + //! log activity coefficients + /*! + * This function is a virtual method. For ideal mixtures + * (unity activity coefficients), this can return zero. + * Implementations should take the derivative of the + * logarithm of the activity coefficient with respect to the + * logarithm of the concentration-like variable (i.e. mole fraction, + * molality, etc.) that represents the standard state. + * This quantity is to be used in conjunction with derivatives of + * that concentration-like variable when the derivative of the chemical + * potential is taken. + * + * units = dimensionless + * + * @param dlnActCoeffdlnC Output vector of log(mole fraction) + * derivatives of the log Activity Coefficients. + * length = m_kk + */ + void IonsFromNeutralVPSSTP::getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const { + s_update_lnActCoeff(); + s_update_dlnActCoeff_dlnC(); + + for (int k = 0; k < m_kk; k++) { + dlnActCoeffdlnC[k] = dlnActCoeffdlnC_Scaled_[k]; + } + } + + + + // This is temporary. We will get rid of this void IonsFromNeutralVPSSTP::setTemperature(doublereal t) { double p = pressure(); @@ -776,21 +827,21 @@ namespace Cantera { neutralMoleculePhase_->setMoleFractions(DATA_PTR(NeutralMolecMoleFractions_)); } - void IonsFromNeutralVPSSTP::setMoleFractions(const doublereal* const y) { - GibbsExcessVPSSTP::setMoleFractions(y); + void IonsFromNeutralVPSSTP::setMoleFractions(const doublereal* const x) { + GibbsExcessVPSSTP::setMoleFractions(x); calcNeutralMoleculeMoleFractions(); neutralMoleculePhase_->setMoleFractions(DATA_PTR(NeutralMolecMoleFractions_)); } - void IonsFromNeutralVPSSTP::setMoleFractions_NoNorm(const doublereal* const y) { - GibbsExcessVPSSTP::setMoleFractions_NoNorm(y); + void IonsFromNeutralVPSSTP::setMoleFractions_NoNorm(const doublereal* const x) { + GibbsExcessVPSSTP::setMoleFractions_NoNorm(x); calcNeutralMoleculeMoleFractions(); neutralMoleculePhase_->setMoleFractions(DATA_PTR(NeutralMolecMoleFractions_)); } - void IonsFromNeutralVPSSTP::setConcentrations(const doublereal* const y) { - GibbsExcessVPSSTP::setConcentrations(y); + void IonsFromNeutralVPSSTP::setConcentrations(const doublereal* const c) { + GibbsExcessVPSSTP::setConcentrations(c); calcNeutralMoleculeMoleFractions(); neutralMoleculePhase_->setMoleFractions(DATA_PTR(NeutralMolecMoleFractions_)); } @@ -979,6 +1030,7 @@ namespace Cantera { muNeutralMolecule_.resize(numNeutralMoleculeSpecies_); gammaNeutralMolecule_.resize(numNeutralMoleculeSpecies_); dlnActCoeffdT_NeutralMolecule_.resize(numNeutralMoleculeSpecies_); + dlnActCoeffdlnC_NeutralMolecule_.resize(numNeutralMoleculeSpecies_); } static double factorOverlap(const std::vector& elnamesVN , @@ -1280,6 +1332,64 @@ namespace Cantera { } + /* + * This function will be called to update the internally storred + * temperature derivative of the natural logarithm of the activity coefficients + */ + void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnC() const { + int k, icat, jNeut; + doublereal fmij; + /* + * Get the activity coefficients of the neutral molecules + */ + GibbsExcessVPSSTP *geThermo = dynamic_cast(neutralMoleculePhase_); + if (!geThermo) { + fvo_zero_dbl_1(dlnActCoeffdlnC_Scaled_, m_kk); + return; + } + + geThermo->getdlnActCoeffdlnC(DATA_PTR(dlnActCoeffdlnC_NeutralMolecule_)); + + switch (ionSolnType_) { + case cIonSolnType_PASSTHROUGH: + break; + case cIonSolnType_SINGLEANION: + + // Do the cation list + for (k = 0; k < (int) cationList_.size(); k++) { + //! Get the id for the next cation + icat = cationList_[k]; + jNeut = fm_invert_ionForNeutral[icat]; + fmij = fm_neutralMolec_ions_[icat + jNeut * m_kk]; + dlnActCoeffdlnC_Scaled_[icat] = fmij * dlnActCoeffdlnC_NeutralMolecule_[jNeut]; + } + + // Do the anion list + icat = anionList_[0]; + jNeut = fm_invert_ionForNeutral[icat]; + dlnActCoeffdT_Scaled_[icat]= 0.0; + + // Do the list of neutral molecules + for (k = 0; k < numPassThroughSpecies_; k++) { + icat = passThroughList_[k]; + jNeut = fm_invert_ionForNeutral[icat]; + dlnActCoeffdlnC_Scaled_[icat] = dlnActCoeffdlnC_NeutralMolecule_[jNeut]; + } + break; + + case cIonSolnType_SINGLECATION: + throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff", "Unimplemented type"); + break; + case cIonSolnType_MULTICATIONANION: + throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff", "Unimplemented type"); + break; + default: + throw CanteraError("IonsFromNeutralVPSSTP::s_update_lnActCoeff", "Unimplemented type"); + break; + } + + } + /** * Format a summary of the mixture state for output. */ diff --git a/Cantera/src/thermo/IonsFromNeutralVPSSTP.h b/Cantera/src/thermo/IonsFromNeutralVPSSTP.h index 66da9ddf0..f9070fa0c 100644 --- a/Cantera/src/thermo/IonsFromNeutralVPSSTP.h +++ b/Cantera/src/thermo/IonsFromNeutralVPSSTP.h @@ -17,7 +17,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: $ + * $Id$ */ #ifndef CT_IONSFROMNEUTRALVPSSTP_H @@ -152,9 +152,9 @@ namespace Cantera { /// Destructor. virtual ~IonsFromNeutralVPSSTP(); - //! Duplication routine for objects which inherit from ThermoPhase. + //! Duplication routine for objects which inherit from ThermoPhase. /*! - * This virtual routine can be used to duplicate thermophase objects + * This virtual routine can be used to duplicate ThermoPhase objects * inherited from ThermoPhase even if the application only has * a pointer to ThermoPhase to work with. */ @@ -404,6 +404,27 @@ namespace Cantera { */ virtual void getPartialMolarEntropies(doublereal* sbar) const; + //! Get the array of log concentration-like derivatives of the + //! log activity coefficients + /*! + * This function is a virtual method. For ideal mixtures + * (unity activity coefficients), this can return zero. + * Implementations should take the derivative of the + * logarithm of the activity coefficient with respect to the + * logarithm of the concentration-like variable (i.e. mole fraction, + * molality, etc.) that represents the standard state. + * This quantity is to be used in conjunction with derivatives of + * that concentration-like variable when the derivative of the chemical + * potential is taken. + * + * units = dimensionless + * + * @param dlnActCoeffdlnC Output vector of log(mole fraction) + * derivatives of the log Activity Coefficients. + * length = m_kk + */ + virtual void getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const; + //@} /// @name Properties of the Standard State of the Species in the Solution @@ -652,13 +673,23 @@ namespace Cantera { */ void s_update_lnActCoeff() const; - //! Update the temperatture derivative of the ln activity coefficients + //! Update the temperature derivative of the ln activity coefficients /*! * This function will be called to update the internally storred * temperature derivative of the natural logarithm of the activity coefficients */ void s_update_dlnActCoeffdT() const; + //! Update the derivative of the log of the activity coefficients + //! wrt log(mole fraction) + /*! + * This function will be called to update the internally storred + * derivative of the natural logarithm of the activity coefficients + * wrt logarithm of the mole fractions. + */ + void s_update_dlnActCoeff_dlnC() const; + + private: //! Error function /*! @@ -689,7 +720,7 @@ namespace Cantera { //! Index of special species int indexSpecialSpecies_; - //! Index of special species + //! Index of special species int indexSecondSpecialSpecies_; //! Formula Matrix for composition of neutral molecules @@ -737,7 +768,7 @@ namespace Cantera { int numCationSpecies_; //! List of the species in this ThermoPhase which are anion species - std::vectoranionList_; + std::vector anionList_; //! Number of anion species int numAnionSpecies_; @@ -754,9 +785,22 @@ namespace Cantera { int numPassThroughSpecies_; public: + //! This is a pointer to the neutral Molecule Phase + /*! + * If the variable, IOwnNThermoPhase_ is true, then we own + * the pointer. If not, then this is considered a shallow pointer. + */ ThermoPhase *neutralMoleculePhase_; - protected: + + private: + + //! If true then we own the underlying neutral Molecule Phase + /*! + * If this is false, then the neutral molecule phase is considered + * as a shallow pointer. + */ bool IOwnNThermoPhase_; + //! ThermoPhase for the cation lattice /*! * Currently this is unimplemented and may be deleted @@ -775,10 +819,8 @@ namespace Cantera { mutable std::vector muNeutralMolecule_; mutable std::vector gammaNeutralMolecule_; mutable std::vector dlnActCoeffdT_NeutralMolecule_; + mutable std::vector dlnActCoeffdlnC_NeutralMolecule_; - private: - - }; diff --git a/Cantera/src/thermo/LatticePhase.cpp b/Cantera/src/thermo/LatticePhase.cpp index 46a951e9c..00942edfb 100644 --- a/Cantera/src/thermo/LatticePhase.cpp +++ b/Cantera/src/thermo/LatticePhase.cpp @@ -8,7 +8,7 @@ * */ /* - * $Id: LatticePhase.cpp,v 1.8 2009/01/02 22:34:41 hkmoffa Exp $ + * $Id$ */ #include "config.h" diff --git a/Cantera/src/thermo/LatticePhase.h b/Cantera/src/thermo/LatticePhase.h index 465d28187..7c160560c 100644 --- a/Cantera/src/thermo/LatticePhase.h +++ b/Cantera/src/thermo/LatticePhase.h @@ -6,9 +6,9 @@ * (see \ref thermoprops and class \link Cantera::LatticePhase LatticePhase\endlink). * */ -/* $Author: hkmoffa $ - * $Date: 2008/12/13 01:59:49 $ - * $Revision: 1.7 $ +/* $Author$ + * $Date$ + * $Revision$ * * Copyright 2005 California Institute of Technology * diff --git a/Cantera/src/thermo/LatticeSolidPhase.cpp b/Cantera/src/thermo/LatticeSolidPhase.cpp index e0e13dddf..e9671db02 100644 --- a/Cantera/src/thermo/LatticeSolidPhase.cpp +++ b/Cantera/src/thermo/LatticeSolidPhase.cpp @@ -2,7 +2,7 @@ * * @file LatticeSolidPhase.cpp * - * $Id: LatticeSolidPhase.cpp,v 1.4 2008/10/08 22:11:08 hkmoffa Exp $ + * $Id$ */ #ifdef WIN32 diff --git a/Cantera/src/thermo/LatticeSolidPhase.h b/Cantera/src/thermo/LatticeSolidPhase.h index 8f765e894..d97116f3b 100644 --- a/Cantera/src/thermo/LatticeSolidPhase.h +++ b/Cantera/src/thermo/LatticeSolidPhase.h @@ -7,9 +7,9 @@ */ -/* $Author: hkmoffa $ - * $Date: 2008/12/13 01:59:49 $ - * $Revision: 1.5 $ +/* $Author$ + * $Date$ + * $Revision$ * * Copyright 2005 California Institute of Technology * diff --git a/Cantera/src/thermo/Makefile.in b/Cantera/src/thermo/Makefile.in index 3a31d01d4..b45d3eb44 100644 --- a/Cantera/src/thermo/Makefile.in +++ b/Cantera/src/thermo/Makefile.in @@ -1,8 +1,8 @@ #/bin/sh ############################################################### -# $Author: hkmoffa $ -# $Date: 2009/03/03 21:08:31 $ -# $Revision: 1.30 $ +# $Author$ +# $Date$ +# $Revision$ # # Copyright 2002 California Institute of Technology # @@ -40,7 +40,7 @@ THERMO_OBJ = State.o Elements.o Constituents.o Phase.o \ ThermoFactory.o phasereport.o SpeciesThermoInterpType.o \ VPSSMgr.o VPSSMgrFactory.o VPSSMgr_General.o IdealSolnGasVPSS.o \ VPSSMgr_IdealGas.o VPSSMgr_ConstVol.o PDSS_ConstVol.o PDSS_IdealGas.o \ - @phase_object_files@ + PDSS_SSVol.o @phase_object_files@ THERMO_H = State.h Elements.h Constituents.h Phase.h mix_defs.h \ ThermoPhase.h IdealGasPhase.h ConstDensityThermo.h \ @@ -54,7 +54,7 @@ THERMO_H = State.h Elements.h Constituents.h Phase.h mix_defs.h \ EdgePhase.h \ VPSSMgr.h VPSSMgrFactory.h VPSSMgr_General.h IdealSolnGasVPSS.h \ VPSSMgr_IdealGas.h VPSSMgr_ConstVol.h PDSS_ConstVol.h PDSS_IdealGas.h \ - @phase_header_files@ + PDSS_SSVol.h @phase_header_files@ # Extended Cantera Thermodynamics Object Files diff --git a/Cantera/src/thermo/MargulesVPSSTP.cpp b/Cantera/src/thermo/MargulesVPSSTP.cpp index c19956c1b..2017d8357 100644 --- a/Cantera/src/thermo/MargulesVPSSTP.cpp +++ b/Cantera/src/thermo/MargulesVPSSTP.cpp @@ -12,8 +12,8 @@ * U.S. Government retains certain rights in this software. */ /* - * $Date: 2009/03/03 21:08:31 $ - * $Revision: 1.1 $ + * $Date$ + * $Revision$ */ @@ -75,7 +75,7 @@ namespace Cantera { MargulesVPSSTP::MargulesVPSSTP(const MargulesVPSSTP &b) : GibbsExcessVPSSTP() { - *this = operator=(b); + MargulesVPSSTP::operator=(b); } /* @@ -86,9 +86,11 @@ namespace Cantera { */ MargulesVPSSTP& MargulesVPSSTP:: operator=(const MargulesVPSSTP &b) { - if (&b != this) { - GibbsExcessVPSSTP::operator=(b); + if (&b == this) { + return *this; } + + GibbsExcessVPSSTP::operator=(b); numBinaryInteractions_ = b.numBinaryInteractions_ ; m_HE_b_ij = b.m_HE_b_ij; @@ -648,6 +650,46 @@ namespace Cantera { } } + // Update the derivative of the log of the activity coefficients wrt ln(X) + /* + * This function will be called to update the internally stored gradients of the + * logarithm of the activity coefficients. These are used in the determination + * of the diffusion coefficients. + * + * he = X_A X_B(B + C(X_A - X_B)) + */ + void MargulesVPSSTP::s_update_dlnActCoeff_dlnC() const { + int iA, iB; + doublereal XA, XB, g0 , g1; + doublereal T = temperature(); + + fvo_zero_dbl_1(dlnActCoeffdlnC_Scaled_, m_kk); + + doublereal RT = GasConstant * T; + for (int i = 0; i < numBinaryInteractions_; i++) { + iA = m_pSpecies_A_ij[i]; + iB = m_pSpecies_B_ij[i]; + + XA = moleFractions_[iA]; + XB = moleFractions_[iB]; + + g0 = (m_HE_b_ij[i] - T * m_SE_b_ij[i]) / RT ; + g1 = (m_HE_c_ij[i] - T * m_SE_c_ij[i]) / RT; + + dlnActCoeffdlnC_Scaled_[iA] += XA * ( ( - 2.0 + 2.0 * XA ) * g0 + + ( - 4.0 + 10.0 * XA - 6.0 * XA*XA ) * g1 ) ; + dlnActCoeffdlnC_Scaled_[iB] += XB * ( ( - 2.0 + 2.0 * XB ) * g0 + + ( 2.0 - 8.0 * XB + 6.0 * XB*XB ) * g1 ) ; + } + } + + void MargulesVPSSTP::getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const { + s_update_dlnActCoeff_dlnC(); + for (int k = 0; k < m_kk; k++) { + dlnActCoeffdlnC[k] = dlnActCoeffdlnC_Scaled_[k]; + } + } + void MargulesVPSSTP::resizeNumInteractions(const int num) { numBinaryInteractions_ = num; diff --git a/Cantera/src/thermo/MargulesVPSSTP.h b/Cantera/src/thermo/MargulesVPSSTP.h index 5f78c12fb..e9044b1bb 100644 --- a/Cantera/src/thermo/MargulesVPSSTP.h +++ b/Cantera/src/thermo/MargulesVPSSTP.h @@ -1,5 +1,5 @@ /** - * @file Margules.h + * @file MargulesVPSSTP.h * Header for intermediate ThermoPhase object for phases which * employ gibbs excess free energy based formulations * (see \ref thermoprops @@ -17,7 +17,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: MargulesVPSSTP.h,v 1.1 2009/03/03 21:08:31 hkmoffa Exp $ + * $Id$ */ #ifndef CT_MARGULESVPSSTP_H @@ -336,10 +336,11 @@ namespace Cantera { //! Special constructor for a hard-coded problem /*! - * - * LiKCl treating the PseudoBinary layer as passthrough. - * -> test to predict the eutectic and liquidus correctly. - * + * + * @param testProb Hard-coded value. Only the value of 1 is + * used. It's for + * a LiKCl system + * -> test to predict the eutectic and liquidus correctly. */ MargulesVPSSTP(int testProb); @@ -350,7 +351,7 @@ namespace Cantera { * * @param b class to be copied */ - MargulesVPSSTP(const MargulesVPSSTP&b); + MargulesVPSSTP(const MargulesVPSSTP& b); //! Assignment operator /*! @@ -537,6 +538,9 @@ namespace Cantera { * \f[ * \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} * \f] + * + * @param hbar Vector of returned partial molar enthalpies + * (length m_kk, units = J/kmol) */ virtual void getPartialMolarEnthalpies(doublereal* hbar) const; @@ -554,6 +558,9 @@ namespace Cantera { * - R \ln( \gamma_k X_k) * - R T \frac{d \ln(\gamma_k) }{dT} * \f] + * + * @param sbar Vector of returned partial molar entropies + * (length m_kk, units = J/kmol/K) */ virtual void getPartialMolarEntropies(doublereal* sbar) const; @@ -567,7 +574,7 @@ namespace Cantera { * Units: J/kmol * * @param mu output vector containing the species electrochemical potentials. - * Length: m_kk. + * Length: m_kk., units = J/kmol */ void getElectrochemPotentials(doublereal* mu) const; @@ -581,10 +588,33 @@ namespace Cantera { * * @param dlnActCoeffdT Output vector of temperature derivatives of the * log Activity Coefficients. length = m_kk + * */ virtual void getdlnActCoeffdT(doublereal *dlnActCoeffdT) const; + //! Get the array of log concentration-like derivatives of the + //! log activity coefficients + /*! + * This function is a virtual method. For ideal mixtures + * (unity activity coefficients), this can return zero. + * Implementations should take the derivative of the + * logarithm of the activity coefficient with respect to the + * logarithm of the concentration-like variable (i.e. mole fraction, + * molality, etc.) that represents the standard state. + * This quantity is to be used in conjunction with derivatives of + * that concentration-like variable when the derivative of the chemical + * potential is taken. + * + * units = dimensionless + * + * @param dlnActCoeffdlnC Output vector of log(mole fraction) + * derivatives of the log Activity Coefficients. + * length = m_kk + */ + virtual void getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const; + + //@} /// @name Properties of the Standard State of the Species in the Solution //@{ @@ -692,11 +722,16 @@ namespace Cantera { * This function reads the XML file and writes the coefficients * it finds to an internal data structures. * - * @param BinSalt reference to the XML_Node named "binaryNeutralSpeciesParameters" - * containing the binary interaction + * @param xmlBinarySpecies Reference to the XML_Node named "binaryNeutralSpeciesParameters" + * containing the binary interaction */ - void readXMLBinarySpecies(XML_Node &xmLBinarySpecies); + void readXMLBinarySpecies(XML_Node &xmlBinarySpecies); + //! Resize internal arrays within the object that depend upon the number + //! of binary Margules interaction terms + /*! + * @param num Number of binary Margules interaction terms + */ void resizeNumInteractions(const int num); @@ -711,14 +746,23 @@ namespace Cantera { */ void s_update_lnActCoeff() const; - // Update the derivative of the log of the activity coefficients wrt T - /* + //! Update the derivative of the log of the activity coefficients wrt T + /*! * This function will be called to update the internally storred - * natural logarithm of the activity coefficients - * + * derivative of the natural logarithm of the activity coefficients + * wrt temperature. */ void s_update_dlnActCoeff_dT() const; + //! Update the derivative of the log of the activity coefficients + //! wrt log(mole fraction) + /*! + * This function will be called to update the internally storred + * derivative of the natural logarithm of the activity coefficients + * wrt logarithm of the mole fractions. + */ + void s_update_dlnActCoeff_dlnC() const; + private: //! Error function @@ -733,30 +777,57 @@ namespace Cantera { //! number of binary interaction expressions - int numBinaryInteractions_; + //! Enthalpy term for the binary mole fraction interaction of the + //! excess gibbs free energy expression mutable vector_fp m_HE_b_ij; + //! Enthalpy term for the ternary mole fraction interaction of the + //! excess gibbs free energy expression mutable vector_fp m_HE_c_ij; + //! Enthalpy term for the quaternary mole fraction interaction of the + //! excess gibbs free energy expression mutable vector_fp m_HE_d_ij; - + //! Entropy term for the binary mole fraction interaction of the + //! excess gibbs free energy expression mutable vector_fp m_SE_b_ij; + //! Entropy term for the ternary mole fraction interaction of the + //! excess gibbs free energy expression mutable vector_fp m_SE_c_ij; + //! Entropy term for the quaternary mole fraction interaction of the + //! excess gibbs free energy expression mutable vector_fp m_SE_d_ij; + //! vector of species indices representing species A in the interaction + /*! + * Each Margules excess Gibbs free energy term involves two species, A and B. + * This vector identifies species A. + */ vector_int m_pSpecies_A_ij; + + //! vector of species indices representing species B in the interaction + /*! + * Each Margules excess Gibbs free energy term involves two species, A and B. + * This vector identifies species B. + */ vector_int m_pSpecies_B_ij; - + //! form of the Margules interaction expression + /*! + * Currently there is only one form. + */ int formMargules_; - int formTempModel_; - private: + //! form of the temperatuer dependence of the Margules interaction expression + /*! + * Currently there is only one form -> constant wrt temperature. + */ + int formTempModel_; }; diff --git a/Cantera/src/thermo/MetalPhase.h b/Cantera/src/thermo/MetalPhase.h index 3d4163252..32ad3431d 100644 --- a/Cantera/src/thermo/MetalPhase.h +++ b/Cantera/src/thermo/MetalPhase.h @@ -4,9 +4,9 @@ * */ -/* $Author: hkmoffa $ - * $Date: 2009/03/24 20:36:05 $ - * $Revision: 1.4 $ +/* $Author$ + * $Date$ + * $Revision$ * * Copyright 2003 California Institute of Technology * diff --git a/Cantera/src/thermo/MineralEQ3.cpp b/Cantera/src/thermo/MineralEQ3.cpp index 849d03e32..1758f95de 100644 --- a/Cantera/src/thermo/MineralEQ3.cpp +++ b/Cantera/src/thermo/MineralEQ3.cpp @@ -14,7 +14,7 @@ */ /* - * $Id: MineralEQ3.cpp,v 1.2 2008/12/27 00:27:55 hkmoffa Exp $ + * $Id$ */ #include "ct_defs.h" diff --git a/Cantera/src/thermo/MineralEQ3.h b/Cantera/src/thermo/MineralEQ3.h index 83077d219..f75f28a9e 100644 --- a/Cantera/src/thermo/MineralEQ3.h +++ b/Cantera/src/thermo/MineralEQ3.h @@ -14,8 +14,8 @@ */ /* - * $Date: 2009/01/04 19:21:28 $ - * $Revision: 1.4 $ + * $Date$ + * $Revision$ */ #ifndef CT_MINERALEQ3_H diff --git a/Cantera/src/thermo/MolalityVPSSTP.cpp b/Cantera/src/thermo/MolalityVPSSTP.cpp index c526ebcce..285289a9e 100644 --- a/Cantera/src/thermo/MolalityVPSSTP.cpp +++ b/Cantera/src/thermo/MolalityVPSSTP.cpp @@ -17,9 +17,9 @@ * U.S. Government retains certain rights in this software. */ /* - * $Author: hkmoffa $ - * $Date: 2009/01/16 16:24:35 $ - * $Revision: 1.23 $ + * $Author$ + * $Date$ + * $Revision$ */ diff --git a/Cantera/src/thermo/MolalityVPSSTP.h b/Cantera/src/thermo/MolalityVPSSTP.h index a635e3091..f9eb439d9 100644 --- a/Cantera/src/thermo/MolalityVPSSTP.h +++ b/Cantera/src/thermo/MolalityVPSSTP.h @@ -17,7 +17,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: MolalityVPSSTP.h,v 1.20 2009/01/20 21:48:54 hkmoffa Exp $ + * $Id$ */ #ifndef CT_MOLALITYVPSSTP_H diff --git a/Cantera/src/thermo/Mu0Poly.cpp b/Cantera/src/thermo/Mu0Poly.cpp index 59cf05441..81cfc3333 100644 --- a/Cantera/src/thermo/Mu0Poly.cpp +++ b/Cantera/src/thermo/Mu0Poly.cpp @@ -6,9 +6,9 @@ * (see \ref spthermo and class \link Cantera::Mu0Poly Mu0Poly\endlink). */ /* - * $Author: dggoodwin $ - * $Revision: 1.1 $ - * $Date: 2007/05/04 14:02:42 $ + * $Author$ + * $Revision$ + * $Date$ */ diff --git a/Cantera/src/thermo/Mu0Poly.h b/Cantera/src/thermo/Mu0Poly.h index ad926486f..b3eee75ba 100644 --- a/Cantera/src/thermo/Mu0Poly.h +++ b/Cantera/src/thermo/Mu0Poly.h @@ -6,9 +6,9 @@ * (see \ref spthermo and class \link Cantera::Mu0Poly Mu0Poly\endlink). */ -/* $Author: hkmoffa $ - * $Revision: 1.2 $ - * $Date: 2007/09/13 15:05:39 $ +/* $Author$ + * $Revision$ + * $Date$ */ diff --git a/Cantera/src/thermo/Nasa9Poly1.cpp b/Cantera/src/thermo/Nasa9Poly1.cpp index dc22c741a..61ecd735f 100644 --- a/Cantera/src/thermo/Nasa9Poly1.cpp +++ b/Cantera/src/thermo/Nasa9Poly1.cpp @@ -10,9 +10,9 @@ * This parameterization has one NASA temperature region. */ -/* $Author: hkmoffa $ - * $Revision: 1.4 $ - * $Date: 2007/12/27 19:09:38 $ +/* $Author$ + * $Revision$ + * $Date$ */ // Copyright 2007 Sandia National Laboratories diff --git a/Cantera/src/thermo/Nasa9Poly1.h b/Cantera/src/thermo/Nasa9Poly1.h index b3447851c..2b8bd5244 100644 --- a/Cantera/src/thermo/Nasa9Poly1.h +++ b/Cantera/src/thermo/Nasa9Poly1.h @@ -19,8 +19,8 @@ #define CT_NASA9POLY1_H /* - * $Revision: 1.4 $ - * $Date: 2009/01/04 19:21:28 $ + * $Revision$ + * $Date$ */ diff --git a/Cantera/src/thermo/Nasa9PolyMultiTempRegion.cpp b/Cantera/src/thermo/Nasa9PolyMultiTempRegion.cpp index 4de34c16f..47c5788e0 100644 --- a/Cantera/src/thermo/Nasa9PolyMultiTempRegion.cpp +++ b/Cantera/src/thermo/Nasa9PolyMultiTempRegion.cpp @@ -11,9 +11,9 @@ * This parameterization has one NASA temperature region. */ -/* $Author: hkmoffa $ - * $Revision: 1.5 $ - * $Date: 2008/03/04 23:40:18 $ +/* $Author$ + * $Revision$ + * $Date$ */ // Copyright 2007 Sandia National Laboratories diff --git a/Cantera/src/thermo/Nasa9PolyMultiTempRegion.h b/Cantera/src/thermo/Nasa9PolyMultiTempRegion.h index b24e83cc9..b29d138f5 100644 --- a/Cantera/src/thermo/Nasa9PolyMultiTempRegion.h +++ b/Cantera/src/thermo/Nasa9PolyMultiTempRegion.h @@ -14,9 +14,9 @@ #ifndef CT_NASA9POLYMULTITEMPREGION_H #define CT_NASA9POLYMULTITEMPREGION_H -/* $Author: hkmoffa $ - * $Revision: 1.3 $ - * $Date: 2007/12/27 19:09:38 $ +/* $Author$ + * $Revision$ + * $Date$ */ // Copyright 2007 Sandia National Laboratories diff --git a/Cantera/src/thermo/NasaPoly1.h b/Cantera/src/thermo/NasaPoly1.h index 17df3a245..60736ecca 100755 --- a/Cantera/src/thermo/NasaPoly1.h +++ b/Cantera/src/thermo/NasaPoly1.h @@ -14,9 +14,9 @@ #define CT_NASAPOLY1_H -/* $Author: hkmoffa $ - * $Revision: 1.3 $ - * $Date: 2008/12/13 01:59:49 $ +/* $Author$ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/NasaPoly2.h b/Cantera/src/thermo/NasaPoly2.h index 0c542abf9..3e885f561 100644 --- a/Cantera/src/thermo/NasaPoly2.h +++ b/Cantera/src/thermo/NasaPoly2.h @@ -8,9 +8,9 @@ * Two zoned Nasa polynomial parameterization */ -/* $Author: hkmoffa $ - * $Revision: 1.3 $ - * $Date: 2008/12/13 01:59:49 $ +/* $Author$ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/NasaThermo.h b/Cantera/src/thermo/NasaThermo.h index 438a6a71b..46cf02a71 100755 --- a/Cantera/src/thermo/NasaThermo.h +++ b/Cantera/src/thermo/NasaThermo.h @@ -7,8 +7,8 @@ */ /* - * $Revision: 1.7 $ - * $Date: 2009/01/04 19:21:28 $ + * $Revision$ + * $Date$ */ // Copyright 2003 California Institute of Technology diff --git a/Cantera/src/thermo/PDSS.cpp b/Cantera/src/thermo/PDSS.cpp index 64a5301b7..8409882fe 100644 --- a/Cantera/src/thermo/PDSS.cpp +++ b/Cantera/src/thermo/PDSS.cpp @@ -10,7 +10,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: PDSS.cpp,v 1.17 2009/01/04 06:34:19 hkmoffa Exp $ + * $Id$ */ #include "ct_defs.h" diff --git a/Cantera/src/thermo/PDSS.h b/Cantera/src/thermo/PDSS.h index 1f542c417..fa0bd9008 100644 --- a/Cantera/src/thermo/PDSS.h +++ b/Cantera/src/thermo/PDSS.h @@ -10,7 +10,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: PDSS.h,v 1.16 2009/01/04 19:21:28 hkmoffa Exp $ + * $Id$ */ #ifndef CT_PDSS_H @@ -65,8 +65,8 @@ namespace Cantera { * but specifies the thermodynamics functions at all pressures. * * Class PDSS is the base class - * for a family of classes that compute properties of all - * species in a phase in their standard states, for a range of temperatures + * for a family of classes that compute properties of a single + * species in a phase at its standard states, for a range of temperatures * and pressures. * * Phases which use the %VPSSMGr class must have their respective @@ -100,7 +100,22 @@ namespace Cantera { * pressure dependencies to these thermo functions. * . * - * - PDSS_Water_ + * - PDSS_SSVol + * - standardState model = "constant_incompressible" || model == "constant" + * - standardState model = "temperature_polynomial" + * - standardState model = "density_temperature_polynomial" + * - This model assumes that the species in the phase obey a + * fairly general equation of state, but one that separates out + * the calculation of the standard state density and/or volume. + * Models include a cubic polynomial in temperature for either + * the standard state volume or the standard state density. + * The manager uses a SimpleThermo object to handle the + * calculation of the reference state. This object then adds the + * pressure dependencies and the volume terms to these thermo functions + * to complete the representation. + * . + * + * - PDSS_Water * - standardState model = "Water" * - This model assumes that * Species 0 is assumed to be water, and a real equation @@ -653,13 +668,13 @@ namespace Cantera { //! State of the system - pressure mutable doublereal m_pres; - //! reference state pressure of the species. + //! Reference state pressure of the species. doublereal m_p0; - //! minimum temperature + //! Minimum temperature doublereal m_minTemp; - //! maximum temperature + //! Maximum temperature doublereal m_maxTemp; //! Thermophase which this species belongs to. diff --git a/Cantera/src/thermo/PDSSFactory.cpp b/Cantera/src/thermo/PDSSFactory.cpp index b8e87c564..b1c27f784 100644 --- a/Cantera/src/thermo/PDSSFactory.cpp +++ b/Cantera/src/thermo/PDSSFactory.cpp @@ -5,7 +5,7 @@ * (see \ref pdssthermo and class \link Cantera::SpeciesThermoFactory SpeciesThermoFactory\endlink); */ /* - * $Id: PDSSFactory.cpp,v 1.2 2008/10/13 21:01:48 hkmoffa Exp $ + * $Id$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/PDSS_ConstVol.cpp b/Cantera/src/thermo/PDSS_ConstVol.cpp index 557be556f..5eff50510 100644 --- a/Cantera/src/thermo/PDSS_ConstVol.cpp +++ b/Cantera/src/thermo/PDSS_ConstVol.cpp @@ -9,7 +9,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: PDSS_ConstVol.cpp,v 1.10 2009/01/04 06:34:20 hkmoffa Exp $ + * $Id$ */ #include "ct_defs.h" diff --git a/Cantera/src/thermo/PDSS_ConstVol.h b/Cantera/src/thermo/PDSS_ConstVol.h index 0d668f1db..87815b047 100644 --- a/Cantera/src/thermo/PDSS_ConstVol.h +++ b/Cantera/src/thermo/PDSS_ConstVol.h @@ -10,7 +10,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: PDSS_ConstVol.h,v 1.6 2008/10/13 21:01:48 hkmoffa Exp $ + * $Id$ */ #ifndef CT_PDSS_CONSTVOL_H @@ -99,7 +99,6 @@ namespace Cantera { * @name Utilities * @{ */ - virtual int pdssType() const { return -1; } /** * @} diff --git a/Cantera/src/thermo/PDSS_HKFT.cpp b/Cantera/src/thermo/PDSS_HKFT.cpp index b78dc22bf..313e140d3 100644 --- a/Cantera/src/thermo/PDSS_HKFT.cpp +++ b/Cantera/src/thermo/PDSS_HKFT.cpp @@ -7,7 +7,7 @@ */ /* - * $Id: PDSS_HKFT.cpp,v 1.22 2009/03/13 03:21:34 hkmoffa Exp $ + * $Id$ */ /* diff --git a/Cantera/src/thermo/PDSS_HKFT.h b/Cantera/src/thermo/PDSS_HKFT.h index cdb95103d..99202cf7b 100644 --- a/Cantera/src/thermo/PDSS_HKFT.h +++ b/Cantera/src/thermo/PDSS_HKFT.h @@ -7,8 +7,8 @@ */ /* - * $Date: 2009/01/04 19:21:28 $ - * $Revision: 1.14 $ + * $Date$ + * $Revision$ */ /* @@ -126,7 +126,6 @@ namespace Cantera { * @name Utilities * @{ */ - virtual int pdssType() const { return -1; } /** * @} diff --git a/Cantera/src/thermo/PDSS_IdealGas.cpp b/Cantera/src/thermo/PDSS_IdealGas.cpp index b34376aa3..48be63302 100644 --- a/Cantera/src/thermo/PDSS_IdealGas.cpp +++ b/Cantera/src/thermo/PDSS_IdealGas.cpp @@ -9,7 +9,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: PDSS_IdealGas.cpp,v 1.8 2009/01/04 06:34:20 hkmoffa Exp $ + * $Id$ */ #include "ct_defs.h" diff --git a/Cantera/src/thermo/PDSS_IdealGas.h b/Cantera/src/thermo/PDSS_IdealGas.h index 9cd996f51..5c2ae566d 100644 --- a/Cantera/src/thermo/PDSS_IdealGas.h +++ b/Cantera/src/thermo/PDSS_IdealGas.h @@ -10,7 +10,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: PDSS_IdealGas.h,v 1.4 2008/10/13 21:01:48 hkmoffa Exp $ + * $Id$ */ #ifndef CT_PDSS_IDEALGAS_H @@ -101,8 +101,6 @@ namespace Cantera { * @name Utilities * @{ */ - virtual int pdssType() const { return -1; } - /** * @} diff --git a/Cantera/src/thermo/PDSS_IonsFromNeutral.cpp b/Cantera/src/thermo/PDSS_IonsFromNeutral.cpp index 1c598b04a..28fa361de 100644 --- a/Cantera/src/thermo/PDSS_IonsFromNeutral.cpp +++ b/Cantera/src/thermo/PDSS_IonsFromNeutral.cpp @@ -9,7 +9,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: PDSS_IonsFromNeutral.cpp,v 1.8 2009/01/04 06:34:20 hkmoffa Exp $ + * $Id$ */ #include "ct_defs.h" @@ -37,8 +37,7 @@ namespace Cantera { { m_pdssType = cPDSS_IONSFROMNEUTRAL; } - - + //==================================================================================================================== PDSS_IonsFromNeutral::PDSS_IonsFromNeutral(VPStandardStateTP *tp, int spindex, std::string inputFile, std::string id) : PDSS(tp, spindex), @@ -50,8 +49,7 @@ namespace Cantera { m_pdssType = cPDSS_IONSFROMNEUTRAL; constructPDSSFile(tp, spindex, inputFile, id); } - - + //==================================================================================================================== PDSS_IonsFromNeutral::PDSS_IonsFromNeutral(VPStandardStateTP *tp, int spindex, const XML_Node& speciesNode, const XML_Node& phaseRoot, bool spInstalled) : @@ -68,8 +66,7 @@ namespace Cantera { std::string id = ""; constructPDSSXML(tp, spindex, speciesNode, phaseRoot, id); } - - + //==================================================================================================================== PDSS_IonsFromNeutral::PDSS_IonsFromNeutral(const PDSS_IonsFromNeutral &b) : PDSS(b) @@ -80,35 +77,57 @@ namespace Cantera { */ *this = b; } - - /** + //==================================================================================================================== + /* * Assignment operator */ PDSS_IonsFromNeutral& PDSS_IonsFromNeutral::operator=(const PDSS_IonsFromNeutral&b) { - if (&b == this) return *this; + if (&b == this) { + return *this; + } + PDSS::operator=(b); m_tmin = b.m_tmin; m_tmax = b.m_tmax; + + /* + * The shallow pointer copy in the next step will be insufficient in most cases. However, its + * functionally the best we can do for this assignment operator. We fix up the pointer in the + * initAllPtrs() function. + */ neutralMoleculePhase_ = b.neutralMoleculePhase_; + numMult_ = b.numMult_; idNeutralMoleculeVec = b.idNeutralMoleculeVec; factorVec = b.factorVec; add2RTln2_ = b.add2RTln2_; + tmpNM = b.tmpNM; specialSpecies_ = b.specialSpecies_; return *this; } - + //==================================================================================================================== PDSS_IonsFromNeutral::~PDSS_IonsFromNeutral() { } - + //==================================================================================================================== //! Duplicator PDSS* PDSS_IonsFromNeutral::duplMyselfAsPDSS() const { PDSS_IonsFromNeutral * idg = new PDSS_IonsFromNeutral(*this); return (PDSS *) idg; } + //==================================================================================================================== + void PDSS_IonsFromNeutral::initAllPtrs(VPStandardStateTP *tp, VPSSMgr *vpssmgr_ptr, + SpeciesThermo* spthermo) { + PDSS::initAllPtrs(tp, vpssmgr_ptr, spthermo); + IonsFromNeutralVPSSTP *ionPhase = dynamic_cast(tp); + if (!ionPhase) { + throw CanteraError("PDSS_IonsFromNeutral::initAllPts", "Dynamic cast failed"); + } + neutralMoleculePhase_ = ionPhase->neutralMoleculePhase_; + } + //==================================================================================================================== /** * constructPDSSXML: * @@ -140,6 +159,9 @@ namespace Cantera { } IonsFromNeutralVPSSTP *ionPhase = dynamic_cast(tp); + if (!ionPhase) { + throw CanteraError("PDSS_IonsFromNeutral::constructPDSSXML", "Dynamic cast failed"); + } neutralMoleculePhase_ = ionPhase->neutralMoleculePhase_; std::vector key; @@ -172,7 +194,7 @@ namespace Cantera { } } - + //==================================================================================================================== void PDSS_IonsFromNeutral::constructPDSSFile(VPStandardStateTP *tp, int spindex, std::string inputFile, std::string id) { diff --git a/Cantera/src/thermo/PDSS_IonsFromNeutral.h b/Cantera/src/thermo/PDSS_IonsFromNeutral.h index 8c545355c..4b95fd6c2 100644 --- a/Cantera/src/thermo/PDSS_IonsFromNeutral.h +++ b/Cantera/src/thermo/PDSS_IonsFromNeutral.h @@ -11,7 +11,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: PDSS_IdealGas.h,v 1.4 2008/10/13 21:01:48 hkmoffa Exp $ + * $Id$ */ #ifndef CT_PDSS_IONSFROMNEUTRAL_H @@ -48,18 +48,6 @@ namespace Cantera { */ PDSS_IonsFromNeutral(VPStandardStateTP *tp, int spindex); - //! Copy Constructur - /*! - * @param b Object to be copied - */ - PDSS_IonsFromNeutral(const PDSS_IonsFromNeutral& b); - - //! Assignment operator - /*! - * @param b Object to be copeid - */ - PDSS_IonsFromNeutral& operator=(const PDSS_IonsFromNeutral& b); - //! Constructor that initializes the object by examining the input file //! of the ThermoPhase object /*! @@ -91,20 +79,48 @@ namespace Cantera { PDSS_IonsFromNeutral(VPStandardStateTP *vptp_ptr, int spindex, const XML_Node& speciesNode, const XML_Node& phaseRef, bool spInstalled); + //! Copy Constructor + /*! + * @param b Object to be copied + */ + PDSS_IonsFromNeutral(const PDSS_IonsFromNeutral& b); + + //! Assignment operator + /*! + * @param b Object to be copeid + */ + PDSS_IonsFromNeutral& operator=(const PDSS_IonsFromNeutral& b); //! Destructor virtual ~PDSS_IonsFromNeutral(); //! Duplicator virtual PDSS *duplMyselfAsPDSS() const; - + + //! Initialize or Reinitialize all shallow pointers in the object + /*! + * This command is called to reinitialize all shallow pointers in the + * object. It's needed for the duplicator capability. + * We need to have an inherited function here to set neutralMoleculePhase_ properly. + * + * @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object + * This object must have already been malloced. + * + * @param vpssmgr_ptr Pointer to the variable pressure standard state + * calculator for this phase + * + * @param spthermo_ptr Pointer to the optional SpeciesThermo object + * that will handle the calculation of the reference + * state thermodynamic coefficients. + */ + virtual void initAllPtrs(VPStandardStateTP *vptp_ptr, VPSSMgr *vpssmgr_ptr, + SpeciesThermo* spthermo_ptr); + /** * @} * @name Utilities * @{ */ - virtual int pdssType() const { return -1; } - /** * @} @@ -438,7 +454,10 @@ namespace Cantera { doublereal m_tmax; - //! Pointer to the Neutral Molecule thermophase object + //! Pointer to the Neutral Molecule ThermoPhase object + /*! + * This is a shallow pointer. + */ ThermoPhase *neutralMoleculePhase_; public: diff --git a/Cantera/src/thermo/PDSS_SSVol.cpp b/Cantera/src/thermo/PDSS_SSVol.cpp new file mode 100644 index 000000000..71ae96fd0 --- /dev/null +++ b/Cantera/src/thermo/PDSS_SSVol.cpp @@ -0,0 +1,435 @@ +/** + * @file PDSS_SSVol.cpp + * Implementation of a pressure dependent standard state + * virtual function. + */ +/* + * Copywrite (2006) Sandia Corporation. Under the terms of + * Contract DE-AC04-94AL85000 with Sandia Corporation, the + * U.S. Government retains certain rights in this software. + */ +/* + * $Id$ + */ + +#include "ct_defs.h" +#include "xml.h" +#include "ctml.h" +#include "PDSS_SSVol.h" +#include "ThermoFactory.h" + +#include "VPStandardStateTP.h" + +using namespace std; + +namespace Cantera { + /** + * Basic list of constructors and duplicators + */ + + PDSS_SSVol::PDSS_SSVol(VPStandardStateTP *tp, int spindex) : + PDSS(tp, spindex), + volumeModel_(cSSVOLUME_CONSTANT), + m_constMolarVolume(-1.0) + { + m_pdssType = cPDSS_SSVOL; + TCoeff_[0] = 0.0; + TCoeff_[1] = 0.0; + TCoeff_[2] = 0.0; + } + + + PDSS_SSVol::PDSS_SSVol(VPStandardStateTP *tp, + int spindex, std::string inputFile, std::string id) : + PDSS(tp, spindex), + volumeModel_(cSSVOLUME_CONSTANT), + m_constMolarVolume(-1.0) + { + + m_pdssType = cPDSS_SSVOL; + constructPDSSFile(tp, spindex, inputFile, id); + } + + PDSS_SSVol::PDSS_SSVol(VPStandardStateTP *tp, int spindex, + const XML_Node& speciesNode, + const XML_Node& phaseRoot, + bool spInstalled) : + PDSS(tp, spindex), + volumeModel_(cSSVOLUME_CONSTANT), + m_constMolarVolume(-1.0) + { + m_pdssType = cPDSS_SSVOL; + constructPDSSXML(tp, spindex, speciesNode, phaseRoot, spInstalled) ; + } + + + PDSS_SSVol::PDSS_SSVol(const PDSS_SSVol &b) : + PDSS(b), + volumeModel_(cSSVOLUME_CONSTANT), + m_constMolarVolume(-1.0) + { + /* + * Use the assignment operator to do the brunt + * of the work for the copy construtor. + */ + *this = b; + } + + /* + * Assignment operator + */ + PDSS_SSVol& PDSS_SSVol::operator=(const PDSS_SSVol&b) { + if (&b == this) return *this; + PDSS::operator=(b); + volumeModel_ = b.volumeModel_; + m_constMolarVolume = b.m_constMolarVolume; + TCoeff_ = b.TCoeff_; + return *this; + } + + PDSS_SSVol::~PDSS_SSVol() { + } + + //! Duplicator + PDSS* PDSS_SSVol::duplMyselfAsPDSS() const { + PDSS_SSVol * idg = new PDSS_SSVol(*this); + return (PDSS *) idg; + } + + /* + * constructPDSSXML: + * + * Initialization of a PDSS_SSVol object using an + * xml file. + * + * This routine is a precursor to initThermo(XML_Node*) + * routine, which does most of the work. + * + * @param infile XML file containing the description of the + * phase + * + * @param id Optional parameter identifying the name of the + * phase. If none is given, the first XML + * phase element will be used. + */ + void PDSS_SSVol::constructPDSSXML(VPStandardStateTP *tp, int spindex, + const XML_Node& speciesNode, + const XML_Node& phaseNode, bool spInstalled) { + PDSS::initThermo(); + SpeciesThermo &sp = m_tp->speciesThermo(); + m_p0 = sp.refPressure(m_spindex); + + if (!spInstalled) { + throw CanteraError("PDSS_SSVol::constructPDSSXML", "spInstalled false not handled"); + } + + const XML_Node *ss = speciesNode.findByName("standardState"); + if (!ss) { + throw CanteraError("PDSS_SSVol::constructPDSSXML", + "no standardState Node for species " + speciesNode.name()); + } + std::string model = (*ss)["model"]; + if (model == "constant_incompressible" || model == "constant") { + volumeModel_ = cSSVOLUME_CONSTANT; + m_constMolarVolume = getFloat(*ss, "molarVolume", "toSI"); + } else if (model == "temperature_polynomial") { + volumeModel_ = cSSVOLUME_TPOLY; + int num = getFloatArray(*ss, TCoeff_, true, "", "volumeTemperaturePolynomial"); + if (num != 4) { + throw CanteraError("PDSS_SSVol::constructPDSSXML", + " Didn't get 4 density polynomial numbers for species " + speciesNode.name()); + } + } else if (model == "density_temperature_polynomial") { + volumeModel_ = cSSVOLUME_DENSITY_TPOLY; + int num = getFloatArray(*ss, TCoeff_, true, "", "densityTemperaturePolynomial"); + if (num != 4) { + throw CanteraError("PDSS_SSVol::constructPDSSXML", + " Didn't get 4 density polynomial numbers for species " + speciesNode.name()); + } + } else { + throw CanteraError("PDSS_SSVol::constructPDSSXML", + "standardState model for species isn't constant_incompressible: " + speciesNode.name()); + } + std::string id = ""; + + } + + + /* + * constructPDSSFile(): + * + * Initialization of a PDSS_SSVol object using an + * xml file. + * + * This routine is a precursor to initThermo(XML_Node*) + * routine, which does most of the work. + * + * @param infile XML file containing the description of the + * phase + * + * @param id Optional parameter identifying the name of the + * phase. If none is given, the first XML + * phase element will be used. + */ + void PDSS_SSVol::constructPDSSFile(VPStandardStateTP *tp, int spindex, + std::string inputFile, std::string id) { + + if (inputFile.size() == 0) { + throw CanteraError("PDSS_SSVol::initThermo", + "input file is null"); + } + std::string path = findInputFile(inputFile); + ifstream fin(path.c_str()); + if (!fin) { + throw CanteraError("PDSS_SSVol::initThermo","could not open " + +path+" for reading."); + } + /* + * The phase object automatically constructs an XML object. + * Use this object to store information. + */ + + XML_Node *fxml = new XML_Node(); + fxml->build(fin); + XML_Node *fxml_phase = findXMLPhase(fxml, id); + if (!fxml_phase) { + throw CanteraError("PDSS_SSVol::initThermo", + "ERROR: Can not find phase named " + + id + " in file named " + inputFile); + } + + XML_Node& speciesList = fxml_phase->child("speciesArray"); + XML_Node* speciesDB = get_XML_NameID("speciesData", speciesList["datasrc"], + &(fxml_phase->root())); + const vector&sss = tp->speciesNames(); + const XML_Node* s = speciesDB->findByAttr("name", sss[spindex]); + + constructPDSSXML(tp, spindex, *s, *fxml_phase, true); + delete fxml; + } + + void PDSS_SSVol::initThermoXML(const XML_Node& phaseNode, std::string& id) { + PDSS::initThermoXML(phaseNode, id); + m_minTemp = m_spthermo->minTemp(m_spindex); + m_maxTemp = m_spthermo->maxTemp(m_spindex); + m_p0 = m_spthermo->refPressure(m_spindex); + m_mw = m_tp->molecularWeight(m_spindex); + } + + void PDSS_SSVol::initThermo() { + PDSS::initThermo(); + SpeciesThermo &sp = m_tp->speciesThermo(); + m_p0 = sp.refPressure(m_spindex); + m_V0_ptr[m_spindex] = m_constMolarVolume; + m_Vss_ptr[m_spindex] = m_constMolarVolume; + } + + doublereal + PDSS_SSVol::enthalpy_mole() const { + doublereal val = enthalpy_RT(); + doublereal RT = GasConstant * m_temp; + return (val * RT); + } + + doublereal + PDSS_SSVol::enthalpy_RT() const { + doublereal val = m_hss_RT_ptr[m_spindex]; + return (val); + } + + doublereal + PDSS_SSVol::intEnergy_mole() const { + doublereal pVRT = (m_pres * m_Vss_ptr[m_spindex]) / (GasConstant * m_temp); + doublereal val = m_h0_RT_ptr[m_spindex] - pVRT; + doublereal RT = GasConstant * m_temp; + return (val * RT); + } + + + doublereal + PDSS_SSVol::entropy_mole() const { + doublereal val = entropy_R(); + return (val * GasConstant); + } + + doublereal + PDSS_SSVol::entropy_R() const { + doublereal val = m_sss_R_ptr[m_spindex]; + return (val); + } + + /** + * Calculate the Gibbs free energy in mks units of + * J kmol-1 K-1. + */ + doublereal + PDSS_SSVol::gibbs_mole() const { + doublereal val = gibbs_RT(); + doublereal RT = GasConstant * m_temp; + return (val * RT); + } + + doublereal + PDSS_SSVol::gibbs_RT() const { + doublereal val = m_gss_RT_ptr[m_spindex]; + return (val); + } + + doublereal + PDSS_SSVol::cp_mole() const { + doublereal val = m_cpss_R_ptr[m_spindex]; + return (val * GasConstant); + } + + doublereal + PDSS_SSVol::cp_R() const { + doublereal val = m_cpss_R_ptr[m_spindex]; + return (val); + } + + doublereal + PDSS_SSVol::cv_mole() const { + doublereal val = (cp_mole() - m_V0_ptr[m_spindex]); + return (val); + } + + doublereal + PDSS_SSVol::molarVolume() const { + doublereal val = m_Vss_ptr[m_spindex]; + return (val); + } + + doublereal + PDSS_SSVol::density() const { + doublereal val = m_Vss_ptr[m_spindex]; + return (m_mw/val); + } + + doublereal + PDSS_SSVol::gibbs_RT_ref() const { + doublereal val = m_g0_RT_ptr[m_spindex]; + return (val); + } + + doublereal PDSS_SSVol::enthalpy_RT_ref() const { + doublereal val = m_h0_RT_ptr[m_spindex]; + return (val); + } + + doublereal PDSS_SSVol::entropy_R_ref() const { + doublereal val = m_s0_R_ptr[m_spindex]; + return (val); + } + + doublereal PDSS_SSVol::cp_R_ref() const { + doublereal val = m_cp0_R_ptr[m_spindex]; + return (val); + } + + doublereal PDSS_SSVol::molarVolume_ref() const { + doublereal val = m_V0_ptr[m_spindex]; + return (val); + } + + void PDSS_SSVol::calcMolarVolume() const { + if (volumeModel_ == cSSVOLUME_CONSTANT ) { + m_Vss_ptr[m_spindex] = m_constMolarVolume; + } else if (volumeModel_ == cSSVOLUME_TPOLY) { + m_Vss_ptr[m_spindex] = TCoeff_[0] + m_temp * (TCoeff_[1] + m_temp * (TCoeff_[2] + m_temp * TCoeff_[3])); + dVdT_ = TCoeff_[1] + 2.0 * m_temp * TCoeff_[2] + 3.0 * m_temp * m_temp * TCoeff_[3]; + d2VdT2_ = 2.0 * TCoeff_[2] + 6.0 * m_temp * TCoeff_[3]; + } else if (volumeModel_ == cSSVOLUME_DENSITY_TPOLY) { + doublereal dens = TCoeff_[0] + m_temp * (TCoeff_[1] + m_temp * (TCoeff_[2] + m_temp * TCoeff_[3])); + m_Vss_ptr[m_spindex] = m_mw / dens; + doublereal dens2 = dens * dens; + doublereal ddensdT = TCoeff_[1] + 2.0 * m_temp * TCoeff_[2] + 3.0 * m_temp * m_temp * TCoeff_[3]; + doublereal d2densdT2 = 2.0 * TCoeff_[2] + 6.0 * m_temp * TCoeff_[3]; + dVdT_ = - m_mw / (dens2) * (ddensdT); + d2VdT2_ = 2.0 * m_mw / (dens2 * dens) * ddensdT * ddensdT - m_mw / dens2 * d2densdT2; + } else { + throw CanteraError("PDSS_SSVol::calcMolarVolume", "unimplemented"); + } + } + + + /// critical temperature + doublereal PDSS_SSVol::critTemperature() const { + throw CanteraError("PDSS_SSVol::critTemperature()", "unimplemented"); + return (0.0); + } + + /// critical pressure + doublereal PDSS_SSVol::critPressure() const { + throw CanteraError("PDSS_SSVol::critPressure()", "unimplemented"); + return (0.0); + } + + /// critical density + doublereal PDSS_SSVol::critDensity() const { + throw CanteraError("PDSS_SSVol::critDensity()", "unimplemented"); + return (0.0); + } + + + + void PDSS_SSVol::setPressure(doublereal p) { + m_pres = p; + doublereal deltaP = m_pres - m_p0; + if (fabs(deltaP) < 1.0E-10) { + m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex]; + m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex]; + m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex]; + m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex]; + } else { + doublereal del_pRT = deltaP / (GasConstant * m_temp); + doublereal sV_term = - deltaP / (GasConstant) * dVdT_; + m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] + sV_term + del_pRT * (m_Vss_ptr[m_spindex]); + m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex] + sV_term; + m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex]; + m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex] - m_temp * deltaP * d2VdT2_; + } + } + + void PDSS_SSVol::setTemperature(doublereal temp) { + m_temp = temp; + m_spthermo->update_one(m_spindex, temp, m_cp0_R_ptr, m_h0_RT_ptr, m_s0_R_ptr); + calcMolarVolume(); + m_g0_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] - m_s0_R_ptr[m_spindex]; + doublereal deltaP = m_pres - m_p0; + if (fabs(deltaP) < 1.0E-10) { + m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex]; + m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex]; + m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex]; + m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex]; + } else { + doublereal del_pRT = deltaP / (GasConstant * m_temp); + doublereal sV_term = - deltaP / (GasConstant) * dVdT_; + m_hss_RT_ptr[m_spindex] = m_h0_RT_ptr[m_spindex] + sV_term + del_pRT * (m_Vss_ptr[m_spindex]); + m_sss_R_ptr[m_spindex] = m_s0_R_ptr[m_spindex] + sV_term; + m_gss_RT_ptr[m_spindex] = m_hss_RT_ptr[m_spindex] - m_sss_R_ptr[m_spindex]; + m_cpss_R_ptr[m_spindex] = m_cp0_R_ptr[m_spindex] - m_temp * deltaP * d2VdT2_; + } + } + + + void PDSS_SSVol::setState_TP(doublereal temp, doublereal pres) { + m_pres = pres; + setTemperature(temp); + } + + + void PDSS_SSVol::setState_TR(doublereal temp, doublereal rho) { + doublereal rhoStored = m_mw / m_constMolarVolume; + if (fabs(rhoStored - rho) / (rhoStored + rho) > 1.0E-4) { + throw CanteraError("PDSS_SSVol::setState_TR", + "Inconsistent supplied rho"); + } + setTemperature(temp); + } + + /// saturation pressure + doublereal PDSS_SSVol::satPressure(doublereal t){ + return (1.0E-200); + } + +} diff --git a/Cantera/src/thermo/PDSS_SSVol.h b/Cantera/src/thermo/PDSS_SSVol.h new file mode 100644 index 000000000..d750d400c --- /dev/null +++ b/Cantera/src/thermo/PDSS_SSVol.h @@ -0,0 +1,586 @@ +/** + * @file PDSS_SSVol.h + * Declarations for the class PDSS_SSVol (pressure dependent standard state) + * which handles calculations for a single species with an expression for the standard state molar volume in a phase + * given by an enumerated data type + * (see class \ref pdssthermo and \link Cantera::PDSS_SSVol PDSS_SSVol\endlink). + */ +/* + * Copywrite (2009) Sandia Corporation. Under the terms of + * Contract DE-AC04-94AL85000 with Sandia Corporation, the + * U.S. Government retains certain rights in this software. + */ +/* + * $Id$ + */ + +#ifndef CT_PDSS_SSVOL_H +#define CT_PDSS_SSVOL_H + +#include "PDSS.h" + +namespace Cantera { + class XML_Node; + class VPStandardStateTP; + + //! Class for pressure dependent standard states that uses a standard state volume + //! model of some sort. + /*! + * Class PDSS_SSVol is an implementation class that compute the properties of a single + * species in a phase at its standard states, for a range of temperatures + * and pressures. This particular class assumes that the calculation of the + * thermodynamics functions can be separated into a temperature polynomial representation + * for thermo functions that can be handled bey a SimpleThermo object and + * a separate calculation for the standard state volume. + * The Models include a cubic polynomial in temperature for either + * the standard state volume or the standard state density. + * The manager uses a SimpleThermo object to handle the + * calculation of the reference state. This object then adds the + * pressure dependencies and the volume terms to these thermo functions + * to complete the representation. + * + * The class includes the following models for the representation of the + * standard state volume: + * + * - Constant Volume + * - This standard state model is invoked with the keyword "constant_incompressible" + * or "constant". The standard state volume is considered constant. + * \f[ + * V^o_k(T,P) = a_0 + * \f] + * . + * + * - Temperature polynomial for the standard state volume + * - This standard state model is invoked with the keyword "temperature_polynomial". + * The standard state volume is considered a function of temperature only. + * \f[ + * V^o_k(T,P) = a_0 + a_1 T + a_2 T^2 + a_3 T^3 + a_4 T^4 + * \f] + * . + * + * - Temperature polynomial for the standard state density + * - This standard state model is invoked with the keyword "density_temperature_polynomial". + * The standard state density, which is the inverse of the volume, + * is considered a function of temperature only. + * \f[ + * {\rho}^o_k(T,P) = \frac{M_k}{V^o_k(T,P)} = a_0 + a_1 T + a_2 T^2 + a_3 T^3 + a_4 T^4 + * \f] + * . + * . + * + * Specification of Species Standard %State Properties + * + * The standard molar Gibbs free energy for species k is determined from the enthalpy + * and entropy expressions + * + * \f[ + * G^o_k(T,P) = H^o_k(T,P) - S^o_k(T,P) + * \f] + * + * The enthalpy is calculated mostly from the %SpeciesThermo object's enthalpy evalulator. The + * dependence on pressure originates from the Maxwell relation + * + * \f[ + * {\left(\frac{dH^o_k}{dP}\right)}_T = T {\left(\frac{dS^o_k}{dP}\right)}_T + V^o_k + * \f] + * which is equal to + * + * \f[ + * {\left(\frac{dH^o_k}{dP}\right)}_T = V^o_k - T {\left(\frac{dV^o_k}{dT}\right)}_P + * \f] + * + * The entropy is calculated mostly from the %SpeciesThermo objects entropy evalulator. The + * dependence on pressure originates from the Maxwell relation: + * + * \f[ + * {\left(\frac{dS^o_k}{dP}\right)}_T = - {\left(\frac{dV^o_k}{dT}\right)}_P + * \f] + * + * The standard state constant-pressure heat capacity expression is obtained from taking the + * temperature derivative of the Maxwell relation involving the enthalpy given above + * to yield an expression for the pressure dependence of the heat capacity. + * + * \f[ + * {\left(\frac{d{C}^o_{p,k}}{dP}\right)}_T = - T {\left(\frac{{d}^2{V}^o_k}{{dT}^2}\right)}_T + * \f] + * + * The standard molar Internal Energy for species k is determined from the following + * relation. + * + * \f[ + * U^o_k(T,P) = H^o_k(T,P) - p V^o_k + * \f] + * + * XML Example + * + * An example of the specification of a standard state for the LiCl molten salt + * which employs a constant molar volume expression. + * + @verbatim + + + Li:1 Cl:1 + + 0.02048004 + + + + + 73.18025, -9.047232, -0.316390, + 0.079587, 0.013594, -417.1314, + 157.6711 + + + + + + @endverbatim + * + * An example of the specification of a standard state for the LiCl molten salt + * which has a temperature dependent standard state volume. + * + @verbatim + + + Li:1 Cl:1 + + + 1.98715, -5.890906E-4, 0.0, 0.0 + + + + + + 73.18025, -9.047232, -0.316390, + 0.079587, 0.013594, -417.1314, + 157.6711 + + + + + + @endverbatim + * + * + * @ingroup pdssthermo + */ + class PDSS_SSVol : public PDSS { + + public: + + /** + * @name Constructors + * @{ + */ + + //! Constructor + /*! + * @param tp Pointer to the ThermoPhase object pertaining to the phase + * @param spindex Species index of the species in the phase + */ + PDSS_SSVol(VPStandardStateTP *tp, int spindex); + + + //! Constructor that initializes the object by examining the input file + //! of the ThermoPhase object + /*! + * This function calls the constructPDSSFile member function. + * + * @param tp Pointer to the ThermoPhase object pertaining to the phase + * @param spindex Species index of the species in the phase + * @param inputFile String name of the input file + * @param id String name of the phase in the input file. The default + * is the empty string, in which case the first phase in the + * file is used. + */ + PDSS_SSVol(VPStandardStateTP *tp, int spindex, + std::string inputFile, std::string id = ""); + + //! Constructor that initializes the object by examining the input file + //! of the ThermoPhase object + /*! + * This function calls the constructPDSSXML member function. + * + * @param vptp_ptr Pointer to the ThermoPhase object pertaining to the phase + * @param spindex Species index of the species in the phase + * @param speciesNode Reference to the species XML tree. + * @param phaseRef Reference to the XML tree containing the phase information. + * @param spInstalled Boolean indicating whether the species is installed yet + * or not. + */ + PDSS_SSVol(VPStandardStateTP *vptp_ptr, int spindex, const XML_Node& speciesNode, + const XML_Node& phaseRef, bool spInstalled); + + //! Copy Constructur + /*! + * @param b Object to be copied + */ + PDSS_SSVol(const PDSS_SSVol &b); + + //! Assignment operator + /*! + * @param b Object to be copeid + */ + PDSS_SSVol& operator=(const PDSS_SSVol&b); + + //! Destructor + virtual ~PDSS_SSVol(); + + //! Duplicator + virtual PDSS *duplMyselfAsPDSS() const; + + /** + * @} + * @name Utilities + * @{ + */ + + /** + * @} + * @name Molar Thermodynamic Properties of the Species Standard State + * in the Solution + * @{ + */ + + //! Return the molar enthalpy in units of J kmol-1 + /*! + * Returns the species standard state enthalpy in J kmol-1 at the + * current temperature and pressure. + * + * @return returns the species standard state enthalpy in J kmol-1 + */ + virtual doublereal enthalpy_mole() const; + + //! Return the standard state molar enthalpy divided by RT + /*! + * Returns the species standard state enthalpy divided by RT at the + * current temperature and pressure. + * + * @return returns the species standard state enthalpy in unitless form + */ + virtual doublereal enthalpy_RT() const; + + //! Return the molar internal Energy in units of J kmol-1 + /*! + * Returns the species standard state internal Energy in J kmol-1 at the + * current temperature and pressure. + * + * @return returns the species standard state internal Energy in J kmol-1 + */ + virtual doublereal intEnergy_mole() const; + + //! Return the molar entropy in units of J kmol-1 K-1 + /*! + * Returns the species standard state entropy in J kmol-1 K-1 at the + * current temperature and pressure. + * + * @return returns the species standard state entropy in J kmol-1 K-1 + */ + virtual doublereal entropy_mole() const; + + //! Return the standard state entropy divided by RT + /*! + * Returns the species standard state entropy divided by RT at the + * current temperature and pressure. + * + * @return returns the species standard state entropy divided by RT + */ + virtual doublereal entropy_R() const; + + //! Return the molar gibbs free energy in units of J kmol-1 + /*! + * Returns the species standard state gibbs free energy in J kmol-1 at the + * current temperature and pressure. + * + * @return returns the species standard state gibbs free energy in J kmol-1 + */ + virtual doublereal gibbs_mole() const; + + //! Return the molar gibbs free energy divided by RT + /*! + * Returns the species standard state gibbs free energy divided by RT at the + * current temperature and pressure. + * + * @return returns the species standard state gibbs free energy divided by RT + */ + virtual doublereal gibbs_RT() const; + + //! Return the molar const pressure heat capacity in units of J kmol-1 K-1 + /*! + * Returns the species standard state Cp in J kmol-1 K-1 at the + * current temperature and pressure. + * + * @return returns the species standard state Cp in J kmol-1 K-1 + */ + virtual doublereal cp_mole() const; + + //! Return the molar const pressure heat capacity divided by RT + /*! + * Returns the species standard state Cp divided by RT at the + * current temperature and pressure. + * + * @return returns the species standard state Cp divided by RT + */ + virtual doublereal cp_R() const; + + //! Return the molar const volume heat capacity in units of J kmol-1 K-1 + /*! + * Returns the species standard state Cv in J kmol-1 K-1 at the + * current temperature and pressure. + * + * @return returns the species standard state Cv in J kmol-1 K-1 + */ + virtual doublereal cv_mole() const; + + //! Return the molar volume at standard state + /*! + * Returns the species standard state molar volume at the + * current temperature and pressure + * + * @return returns the standard state molar volume divided by R + * units are m**3 kmol-1. + */ + virtual doublereal molarVolume() const; + + //! Return the standard state density at standard state + /*! + * Returns the species standard state density at the + * current temperature and pressure + * + * @return returns the standard state density + * units are kg m-3 + */ + virtual doublereal density() const; + + /** + * @} + * @name Properties of the Reference State of the Species + * in the Solution + * @{ + */ + + //! Return the molar gibbs free energy divided by RT at reference pressure + /*! + * Returns the species reference state gibbs free energy divided by RT at the + * current temperature. + * + * @return returns the reference state gibbs free energy divided by RT + */ + virtual doublereal gibbs_RT_ref() const; + + //! Return the molar enthalpy divided by RT at reference pressure + /*! + * Returns the species reference state enthalpy divided by RT at the + * current temperature. + * + * @return returns the reference state enthalpy divided by RT + */ + virtual doublereal enthalpy_RT_ref() const; + + //! Return the molar entropy divided by R at reference pressure + /*! + * Returns the species reference state entropy divided by R at the + * current temperature. + * + * @return returns the reference state entropy divided by R + */ + virtual doublereal entropy_R_ref() const; + + //! Return the molar heat capacity divided by R at reference pressure + /*! + * Returns the species reference state heat capacity divided by R at the + * current temperature. + * + * @return returns the reference state heat capacity divided by R + */ + virtual doublereal cp_R_ref() const; + + //! Return the molar volume at reference pressure + /*! + * Returns the species reference state molar volume at the + * current temperature. + * + * @return returns the reference state molar volume divided by R + * units are m**3 kmol-1. + */ + virtual doublereal molarVolume_ref() const; + + private: + + //! Does the internal calculation of the volume + /*! + * + */ + void calcMolarVolume() const; + + /** + * @} + * @name Mechanical Equation of State Properties + * @{ + */ + + //! Sets the pressure in the object + /*! + * Currently, this sets the pressure in the PDSS object. + * It is indeterminant what happens to the owning VPStandardStateTP + * object and to the VPSSMgr object. + * + * @param pres Pressure to be set (Pascal) + */ + virtual void setPressure(doublereal pres); + + //! Set the internal temperature + /*! + * @param temp Temperature (Kelvin) + */ + virtual void setTemperature(doublereal temp); + + //! Set the internal temperature and pressure + /*! + * @param temp Temperature (Kelvin) + * @param pres pressure (Pascals) + */ + virtual void setState_TP(doublereal temp, doublereal pres); + + + //! Set the internal temperature and density + /*! + * @param temp Temperature (Kelvin) + * @param rho Density (kg m-3) + */ + virtual void setState_TR(doublereal temp, doublereal rho); + + /** + * @} + * @name Miscellaneous properties of the standard state + * @{ + */ + + /// critical temperature + virtual doublereal critTemperature() const; + + /// critical pressure + virtual doublereal critPressure() const; + + /// critical density + virtual doublereal critDensity() const; + + /// saturation pressure + /*! + * @param t Temperature (kelvin) + */ + virtual doublereal satPressure(doublereal t); + + /** + * @} + * @name Initialization of the Object + * @{ + */ + + //! Initialization routine for all of the shallow pointers + /*! + * This is a cascading call, where each level should call the + * the parent level. + * + * The initThermo() routines get called before the initThermoXML() routines + * from the constructPDSSXML() routine. + * + * + * Calls initPtrs(); + */ + virtual void initThermo(); + + //! Initialization of a PDSS object using an + //! input XML file. + /*! + * + * This routine is a precursor to constructPDSSXML(XML_Node*) + * routine, which does most of the work. + * + * @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object + * This object must have already been malloced. + * + * @param spindex Species index within the phase + * + * @param inputFile XML file containing the description of the + * phase + * + * @param id Optional parameter identifying the name of the + * phase. If none is given, the first XML + * phase element will be used. + */ + void constructPDSSFile(VPStandardStateTP *vptp_ptr, int spindex, + std::string inputFile, std::string id); + + //! Initialization of a PDSS object using an xml tree + /*! + * This routine is a driver for the initialization of the + * object. + * + * basic logic: + * initThermo() (cascade) + * getStuff from species Part of XML file + * initThermoXML(phaseNode) (cascade) + * + * @param vptp_ptr Pointer to the Variable pressure %ThermoPhase object + * This object must have already been malloced. + * + * @param spindex Species index within the phase + * + * @param speciesNode XML Node containing the species information + * + * @param phaseNode Reference to the phase Information for the phase + * that owns this species. + * + * @param spInstalled Boolean indicating whether the species is + * already installed. + */ + void constructPDSSXML(VPStandardStateTP *vptp_ptr, int spindex, + const XML_Node& speciesNode, + const XML_Node& phaseNode, bool spInstalled); + + //! Initialization routine for the PDSS object based on the phaseNode + /*! + * This is a cascading call, where each level should call the + * the parent level. + * + * @param phaseNode Reference to the phase Information for the phase + * that owns this species. + * + * @param id Optional parameter identifying the name of the + * phase. If none is given, the first XML + * phase element will be used. + */ + virtual void initThermoXML(const XML_Node& phaseNode, std::string& id); + + //@} + + private: + + //! Enumerated data type describing the type of volume model + //! used to calculate the standard state volume of the species + SSVolume_Model_enumType volumeModel_; + + //! Value of the constant molar volume for the species + /*! + * m3 / kmol + */ + doublereal m_constMolarVolume; + + //! coefficients for the temperature representation + vector_fp TCoeff_; + + //! Derivative of the volume wrt temperature + mutable doublereal dVdT_; + + //! 2nd derivative of the volume wrt temperature + mutable doublereal d2VdT2_; + + }; + +} + +#endif + + + diff --git a/Cantera/src/thermo/PDSS_Water.cpp b/Cantera/src/thermo/PDSS_Water.cpp index 50beffd50..9a6170521 100644 --- a/Cantera/src/thermo/PDSS_Water.cpp +++ b/Cantera/src/thermo/PDSS_Water.cpp @@ -8,7 +8,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: PDSS_Water.cpp,v 1.15 2008/12/22 22:40:44 hkmoffa Exp $ + * $Id$ */ #include "ct_defs.h" diff --git a/Cantera/src/thermo/PDSS_Water.h b/Cantera/src/thermo/PDSS_Water.h index 06425eb0b..e01871252 100644 --- a/Cantera/src/thermo/PDSS_Water.h +++ b/Cantera/src/thermo/PDSS_Water.h @@ -9,9 +9,9 @@ * Contract DE-AC04-94AL85000 with Sandia Corporation, the * U.S. Government retains certain rights in this software. */ -/* $Author: hkmoffa $ - * $Date: 2009/01/03 03:59:39 $ - * $Revision: 1.11 $ +/* $Author$ + * $Date$ + * $Revision$ */ #ifndef CT_PDSS_WATER_H diff --git a/Cantera/src/thermo/Phase.h b/Cantera/src/thermo/Phase.h index 12bdf7e90..60c5ec06a 100755 --- a/Cantera/src/thermo/Phase.h +++ b/Cantera/src/thermo/Phase.h @@ -8,9 +8,9 @@ */ /* - * $Author: hkmoffa $ - * $Revision: 1.5 $ - * $Date: 2008/02/03 20:59:18 $ + * $Author$ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology @@ -502,6 +502,7 @@ namespace Cantera { * base classes become hidden. */ int m_kk; + /** * m_ndim is the dimensionality of the phase. Volumetric * phases have dimensionality 3 and surface phases have diff --git a/Cantera/src/thermo/PseudoBinaryVPSSTP.cpp b/Cantera/src/thermo/PseudoBinaryVPSSTP.cpp index 12ee677af..f909098a6 100644 --- a/Cantera/src/thermo/PseudoBinaryVPSSTP.cpp +++ b/Cantera/src/thermo/PseudoBinaryVPSSTP.cpp @@ -17,8 +17,8 @@ * U.S. Government retains certain rights in this software. */ /* - * $Date: 2009/03/27 01:08:55 $ - * $Revision: 1.2 $ + * $Date$ + * $Revision$ */ diff --git a/Cantera/src/thermo/PseudoBinaryVPSSTP.h b/Cantera/src/thermo/PseudoBinaryVPSSTP.h index b62053e8c..3cc9a9d5b 100644 --- a/Cantera/src/thermo/PseudoBinaryVPSSTP.h +++ b/Cantera/src/thermo/PseudoBinaryVPSSTP.h @@ -17,7 +17,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: PseudoBinaryVPSSTP.h,v 1.1 2009/03/03 21:08:31 hkmoffa Exp $ + * $Id$ */ #ifndef CT_PSEUDOBINARYVPSSTP_H diff --git a/Cantera/src/thermo/PureFluidPhase.cpp b/Cantera/src/thermo/PureFluidPhase.cpp index 5ce137eee..a0748e18c 100644 --- a/Cantera/src/thermo/PureFluidPhase.cpp +++ b/Cantera/src/thermo/PureFluidPhase.cpp @@ -6,7 +6,7 @@ * and class \link Cantera::PureFluidPhase PureFluidPhase\endlink). */ /* - * $Id: PureFluidPhase.cpp,v 1.5 2009/03/13 03:21:34 hkmoffa Exp $ + * $Id$ */ #include "xml.h" #include "PureFluidPhase.h" diff --git a/Cantera/src/thermo/PureFluidPhase.h b/Cantera/src/thermo/PureFluidPhase.h index a1f674f38..2e2c626c1 100644 --- a/Cantera/src/thermo/PureFluidPhase.h +++ b/Cantera/src/thermo/PureFluidPhase.h @@ -10,9 +10,9 @@ * It inherits from ThermoPhase, but is built on top of the tpx package. */ -/* $Author: dggoodwin $ - * $Date: 2007/12/24 15:32:30 $ - * $Revision: 1.7 $ +/* $Author$ + * $Date$ + * $Revision$ * * Copyright 2003 California Institute of Technology */ diff --git a/Cantera/src/thermo/SemiconductorPhase.h b/Cantera/src/thermo/SemiconductorPhase.h index c82fbbd8b..561d7df0b 100644 --- a/Cantera/src/thermo/SemiconductorPhase.h +++ b/Cantera/src/thermo/SemiconductorPhase.h @@ -4,9 +4,9 @@ * */ -/* $Author: dggoodwin $ - * $Date: 2007/11/27 13:26:08 $ - * $Revision: 1.2 $ +/* $Author$ + * $Date$ + * $Revision$ * * Copyright 2003 California Institute of Technology * diff --git a/Cantera/src/thermo/ShomatePoly.h b/Cantera/src/thermo/ShomatePoly.h index 25745a4aa..2937d8f0b 100755 --- a/Cantera/src/thermo/ShomatePoly.h +++ b/Cantera/src/thermo/ShomatePoly.h @@ -8,9 +8,9 @@ * Shomate polynomial expressions. */ /* - * $Author: hkmoffa $ - * $Revision: 1.3 $ - * $Date: 2008/12/13 01:59:49 $ + * $Author$ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/ShomateThermo.h b/Cantera/src/thermo/ShomateThermo.h index 3d7869f2a..c37822801 100755 --- a/Cantera/src/thermo/ShomateThermo.h +++ b/Cantera/src/thermo/ShomateThermo.h @@ -6,7 +6,7 @@ * \link Cantera::ShomateThermo ShomateThermo\endlink). */ /* - * $Id: ShomateThermo.h,v 1.6 2008/12/13 01:59:49 hkmoffa Exp $ + * $Id$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/SimpleThermo.h b/Cantera/src/thermo/SimpleThermo.h index c64c8da5e..e0536259f 100644 --- a/Cantera/src/thermo/SimpleThermo.h +++ b/Cantera/src/thermo/SimpleThermo.h @@ -6,7 +6,7 @@ * \link Cantera::SimpleThermo SimpleThermo\endlink). */ /* - * $Id: SimpleThermo.h,v 1.9 2008/12/13 01:59:49 hkmoffa Exp $ + * $Id$ */ #ifndef CT_SIMPLETHERMO_H @@ -52,7 +52,7 @@ namespace Cantera { public: //! Initialized to the type of parameterization - /*! + /*!A * Note, this value is used in some template functions. For this object the * value is SIMPLE. */ diff --git a/Cantera/src/thermo/SingleSpeciesTP.cpp b/Cantera/src/thermo/SingleSpeciesTP.cpp index 5b89c2d6b..e9980ada2 100644 --- a/Cantera/src/thermo/SingleSpeciesTP.cpp +++ b/Cantera/src/thermo/SingleSpeciesTP.cpp @@ -12,9 +12,9 @@ */ /* - * $Author: hkmoffa $ - * $Date: 2007/06/05 15:17:15 $ - * $Revision: 1.10 $ + * $Author$ + * $Date$ + * $Revision$ */ #include "SingleSpeciesTP.h" diff --git a/Cantera/src/thermo/SingleSpeciesTP.h b/Cantera/src/thermo/SingleSpeciesTP.h index 56ffa94ce..59e726bf2 100644 --- a/Cantera/src/thermo/SingleSpeciesTP.h +++ b/Cantera/src/thermo/SingleSpeciesTP.h @@ -13,9 +13,9 @@ /* - * $Author: hkmoffa $ - * $Date: 2008/12/13 01:59:49 $ - * $Revision: 1.13 $ + * $Author$ + * $Date$ + * $Revision$ * */ diff --git a/Cantera/src/thermo/SpeciesThermo.h b/Cantera/src/thermo/SpeciesThermo.h index d34cf2ecd..35b8c8edb 100755 --- a/Cantera/src/thermo/SpeciesThermo.h +++ b/Cantera/src/thermo/SpeciesThermo.h @@ -6,9 +6,9 @@ */ /* - * $Author: hkmoffa $ - * $Revision: 1.10 $ - * $Date: 2008/12/13 01:59:49 $ + * $Author$ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/SpeciesThermoFactory.cpp b/Cantera/src/thermo/SpeciesThermoFactory.cpp index 89bea1928..06c48c269 100755 --- a/Cantera/src/thermo/SpeciesThermoFactory.cpp +++ b/Cantera/src/thermo/SpeciesThermoFactory.cpp @@ -5,8 +5,8 @@ * (see \ref spthermo and class \link Cantera::SpeciesThermoFactory SpeciesThermoFactory\endlink); */ /* - * $Revision: 1.20 $ - * $Date: 2008/12/29 21:35:15 $ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/SpeciesThermoFactory.h b/Cantera/src/thermo/SpeciesThermoFactory.h index 7d7af60e7..172b0f939 100755 --- a/Cantera/src/thermo/SpeciesThermoFactory.h +++ b/Cantera/src/thermo/SpeciesThermoFactory.h @@ -7,8 +7,8 @@ */ /* - * $Revision: 1.11 $ - * $Date: 2009/02/11 20:03:08 $ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/SpeciesThermoInterpType.cpp b/Cantera/src/thermo/SpeciesThermoInterpType.cpp index ce6de7c43..7b7fa5365 100644 --- a/Cantera/src/thermo/SpeciesThermoInterpType.cpp +++ b/Cantera/src/thermo/SpeciesThermoInterpType.cpp @@ -3,9 +3,9 @@ * Definitions for a */ -/* $Author: hkmoffa $ - * $Revision: 1.5 $ - * $Date: 2009/01/04 06:34:20 $ +/* $Author$ + * $Revision$ + * $Date$ */ // Copyright 2007 Sandia National Laboratories diff --git a/Cantera/src/thermo/SpeciesThermoInterpType.h b/Cantera/src/thermo/SpeciesThermoInterpType.h index a1b22903c..6e8f83b04 100644 --- a/Cantera/src/thermo/SpeciesThermoInterpType.h +++ b/Cantera/src/thermo/SpeciesThermoInterpType.h @@ -5,9 +5,9 @@ * (see \ref spthermo and class \link Cantera::SpeciesThermoInterpType SpeciesThermoInterpType \endlink). */ /* - * $Author: hkmoffa $ - * $Revision: 1.8 $ - * $Date: 2008/12/13 01:59:49 $ + * $Author$ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/SpeciesThermoMgr.h b/Cantera/src/thermo/SpeciesThermoMgr.h index 3728dbdb1..14d5347c3 100755 --- a/Cantera/src/thermo/SpeciesThermoMgr.h +++ b/Cantera/src/thermo/SpeciesThermoMgr.h @@ -7,9 +7,9 @@ * \link Cantera::SpeciesThermoDuo SpeciesThermoDuo\endlink and * \link Cantera::SpeciesThermo1 SpeciesThermo1\endlink) * - * $Author: hkmoffa $ - * $Revision: 1.12 $ - * $Date: 2009/02/11 20:03:08 $ + * $Author$ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/State.cpp b/Cantera/src/thermo/State.cpp index d31c4f774..6191ce6bd 100644 --- a/Cantera/src/thermo/State.cpp +++ b/Cantera/src/thermo/State.cpp @@ -7,8 +7,8 @@ /* * - * $Date: 2009/03/03 19:53:34 $ - * $Revision: 1.8 $ + * $Date$ + * $Revision$ * * Copyright 2003-2004 California Institute of Technology * See file License.txt for licensing information @@ -196,22 +196,22 @@ namespace Cantera { return density()/meanMolecularWeight(); } - void State::setConcentrations(const doublereal* const c) { + void State::setConcentrations(const doublereal* const conc) { int k; doublereal sum = 0.0, norm = 0.0; for (k = 0; k != m_kk; ++k) { - sum += c[k]*m_molwts[k]; - norm += c[k]; + sum += conc[k]*m_molwts[k]; + norm += conc[k]; } m_mmw = sum/norm; setDensity(sum); doublereal rsum = 1.0/sum; for (k = 0; k != m_kk; ++k) { - m_ym[k] = c[k] * rsum; + m_ym[k] = conc[k] * rsum; m_y[k] = m_ym[k] * m_molwts[k]; } - //! Call a routine to determin whether state has changed. + // Call a routine to determine whether state has changed. stateMFChangeCalc(); } diff --git a/Cantera/src/thermo/State.h b/Cantera/src/thermo/State.h old mode 100755 new mode 100644 index b5bd5eca8..60681a0fd --- a/Cantera/src/thermo/State.h +++ b/Cantera/src/thermo/State.h @@ -6,8 +6,8 @@ */ /* - * $Date: 2009/02/15 17:33:06 $ - * $Revision: 1.6 $ + * $Date$ + * $Revision$ * * Copyright 2001-2003 California Institute of Technology * See file License.txt for licensing information @@ -123,14 +123,18 @@ namespace Cantera { */ doublereal moleFraction(const int k) const; - /** - * Set the mole fractions to the specified values, and then - * normalize them so that they sum to 1.0. + + //! Set the mole fractions to the specified values, and then + //! normalize them so that they sum to 1.0. + /*! * @param x Array of unnormalized mole fraction values (input). - * Must have a length greater than or equal to the number of - * species. + * Must have a length greater than or equal to the number of + * species. * - * @param x Input vector of mole fractions. + * @param x Input vector of mole fractions. There is no restriction + * on the sum of the mole fraction vector. Internally, + * the State object will normalize this vector before + * storring its contents. * Length is m_kk. */ virtual void setMoleFractions(const doublereal* const x); @@ -176,7 +180,10 @@ namespace Cantera { * Must have a length greater than or equal to the number of * species. * - * @param y Input vector of mass fractions. + * @param y Input vector of mass fractions. There is no restriction + * on the sum of the mass fraction vector. Internally, + * the State object will normalize this vector before + * storring its contents. * Length is m_kk. */ virtual void setMassFractions(const doublereal* const y); @@ -209,22 +216,29 @@ namespace Cantera { */ doublereal concentration(const int k) const; - /** - * Set the concentrations to the specified values within the - * phase. + + //! Set the concentrations to the specified values within the + //! phase. + /*! + * We set the concentrations here and therefore we set the + * overall density of the phase. We hold the temperature constant + * during this operation. Therefore, we have possibly changed + * the pressure of the phase by calling this routine. * - * @param c The input vector to this routine is in dimensional - * units. For volumetric phases c[k] is the - * concentration of the kth species in kmol/m3. - * For surface phases, c[k] is the concentration - * in kmol/m2. The length of the vector is the number - * of species in the phase. + * @param conc The input vector to this routine is in dimensional + * units. For volumetric phases c[k] is the + * concentration of the kth species in kmol/m3. + * For surface phases, c[k] is the concentration + * in kmol/m2. The length of the vector is the number + * of species in the phase. */ - virtual void setConcentrations(const doublereal* const c); + virtual void setConcentrations(const doublereal* const conc); - /** - * Returns a read-only pointer to the start of the - * massFraction array + //! Returns a read-only pointer to the start of the + //! massFraction array + /*! + * The pointer returned is readonly + * @return returns a pointer to a vector of doubles of length m_kk. */ const doublereal* massFractions() const { return &m_y[0]; diff --git a/Cantera/src/thermo/StoichSubstance.cpp b/Cantera/src/thermo/StoichSubstance.cpp index 964e040aa..7770c149a 100644 --- a/Cantera/src/thermo/StoichSubstance.cpp +++ b/Cantera/src/thermo/StoichSubstance.cpp @@ -5,8 +5,8 @@ * ThermoPhase class. */ /* - * $Date: 2009/01/04 21:28:02 $ - * $Revision: 1.8 $ + * $Date$ + * $Revision$ * * Copyright 2001 California Institute of Technology * diff --git a/Cantera/src/thermo/StoichSubstance.h b/Cantera/src/thermo/StoichSubstance.h index b1b8ffa26..991ef4962 100644 --- a/Cantera/src/thermo/StoichSubstance.h +++ b/Cantera/src/thermo/StoichSubstance.h @@ -5,8 +5,8 @@ */ /* - * $Date: 2009/01/04 21:28:02 $ - * $Revision: 1.8 $ + * $Date$ + * $Revision$ * * Copyright 2001 California Institute of Technology * diff --git a/Cantera/src/thermo/StoichSubstanceSSTP.cpp b/Cantera/src/thermo/StoichSubstanceSSTP.cpp index 7c4a6ee93..565e7cfc5 100644 --- a/Cantera/src/thermo/StoichSubstanceSSTP.cpp +++ b/Cantera/src/thermo/StoichSubstanceSSTP.cpp @@ -14,7 +14,7 @@ */ /* - * $Id: StoichSubstanceSSTP.cpp,v 1.13 2009/01/02 20:04:17 hkmoffa Exp $ + * $Id$ */ #include "ct_defs.h" diff --git a/Cantera/src/thermo/StoichSubstanceSSTP.h b/Cantera/src/thermo/StoichSubstanceSSTP.h index 0f59c7888..59b5598c4 100644 --- a/Cantera/src/thermo/StoichSubstanceSSTP.h +++ b/Cantera/src/thermo/StoichSubstanceSSTP.h @@ -12,8 +12,8 @@ */ /* - * $Date: 2009/01/02 20:04:17 $ - * $Revision: 1.12 $ + * $Date$ + * $Revision$ */ #ifndef CT_STOICHSUBSTANCESSTP_H diff --git a/Cantera/src/thermo/SurfPhase.cpp b/Cantera/src/thermo/SurfPhase.cpp index 4d58bb9d2..44fea43fd 100644 --- a/Cantera/src/thermo/SurfPhase.cpp +++ b/Cantera/src/thermo/SurfPhase.cpp @@ -7,8 +7,8 @@ */ /* - * $Revision: 1.13 $ - * $Date: 2009/01/24 00:15:00 $ + * $Revision$ + * $Date$ */ // Copyright 2002 California Institute of Technology diff --git a/Cantera/src/thermo/SurfPhase.h b/Cantera/src/thermo/SurfPhase.h index 978c1f760..2872c9db4 100644 --- a/Cantera/src/thermo/SurfPhase.h +++ b/Cantera/src/thermo/SurfPhase.h @@ -7,8 +7,8 @@ */ /* - * $Date: 2009/01/04 21:28:02 $ - * $Revision: 1.11 $ + * $Date$ + * $Revision$ * * Copyright 2002 California Institute of Technology * diff --git a/Cantera/src/thermo/ThermoFactory.cpp b/Cantera/src/thermo/ThermoFactory.cpp index 70ad4164d..5cc165beb 100644 --- a/Cantera/src/thermo/ThermoFactory.cpp +++ b/Cantera/src/thermo/ThermoFactory.cpp @@ -6,8 +6,8 @@ */ /* - * $Revision: 1.20 $ - * $Date: 2009/03/13 03:21:34 $ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/ThermoFactory.h b/Cantera/src/thermo/ThermoFactory.h index 77dccd54e..b9a034086 100644 --- a/Cantera/src/thermo/ThermoFactory.h +++ b/Cantera/src/thermo/ThermoFactory.h @@ -6,9 +6,9 @@ */ /* - * $Author: hkmoffa $ - * $Revision: 1.10 $ - * $Date: 2009/02/11 20:03:08 $ + * $Author$ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology diff --git a/Cantera/src/thermo/ThermoPhase.cpp b/Cantera/src/thermo/ThermoPhase.cpp index 1e6e1fddd..eb0e60250 100644 --- a/Cantera/src/thermo/ThermoPhase.cpp +++ b/Cantera/src/thermo/ThermoPhase.cpp @@ -6,9 +6,9 @@ */ /* - * $Author: hkmoffa $ - * $Date: 2009/03/03 19:53:34 $ - * $Revision: 1.18 $ + * $Author$ + * $Date$ + * $Revision$ * * Copyright 2002 California Institute of Technology * diff --git a/Cantera/src/thermo/ThermoPhase.h b/Cantera/src/thermo/ThermoPhase.h old mode 100755 new mode 100644 index 9df05133b..a4ef04d99 --- a/Cantera/src/thermo/ThermoPhase.h +++ b/Cantera/src/thermo/ThermoPhase.h @@ -7,8 +7,8 @@ */ /* - * $Date: 2009/02/18 22:31:32 $ - * $Revision: 1.26 $ + * $Date$ + * $Revision$ * * Copyright 2002 California Institute of Technology * @@ -848,6 +848,29 @@ namespace Cantera { } + //! Get the array of log concentration-like derivatives of the + //! log activity coefficients + /*! + * This function is a virtual method. For ideal mixtures + * (unity activity coefficients), this can return zero. + * Implementations should take the derivative of the + * logarithm of the activity coefficient with respect to the + * logarithm of the concentration-like variable (i.e. mole fraction, + * molality, etc.) that represents the standard state. + * This quantity is to be used in conjunction with derivatives of + * that concentration-like variable when the derivative of the chemical + * potential is taken. + * + * units = dimensionless + * + * @param dlnActCoeffdlnC Output vector of derivatives of the + * log Activity Coefficients. length = m_kk + */ + virtual void getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const { + err("getdlnActCoeffdlnC"); + } + + /** * @} * @name Mechanical Properties diff --git a/Cantera/src/thermo/VPSSMgr.cpp b/Cantera/src/thermo/VPSSMgr.cpp index 403117bef..64ec7e22c 100644 --- a/Cantera/src/thermo/VPSSMgr.cpp +++ b/Cantera/src/thermo/VPSSMgr.cpp @@ -12,9 +12,9 @@ * U.S. Government retains certain rights in this software. */ /* - * $Author: hkmoffa $ - * $Date: 2009/05/28 23:08:06 $ - * $Revision: 1.8 $ + * $Author$ + * $Date$ + * $Revision$ */ // turn off warnings under Windows @@ -74,12 +74,30 @@ namespace Cantera { *this = right; } + //==================================================================================================================== + /* + * Assigment operator + * We use a shallow copy strategy here. Note, this will have to be fixed up later. + */ VPSSMgr& VPSSMgr::operator=(const VPSSMgr &right) { if (&right == this) { return *this; } m_kk = right.m_kk; + /* + * What we are doing here is to make a shallow copy of the VPStandardStateTP + * pointer in the "new" VPSSMgr object using the value from the "old" + * VPSSMgr object. This is not appropriate if we are making a copy of a ThermoPhase + * object and the VPSSMgr objects are owned by the ThermoPhase object. + * + * The new object will want to have a different value of m_vptp_ptr than the + * value this is being copied here. It will want to refer to the copy of the + * VPStandardStateTP object being made that will own the new VPSSMgr object. + * However, the assignment object is not the place to carry out this fixup. + * + * We will have to "fix" up the shallow copies later. + */ m_vptp_ptr = right.m_vptp_ptr; m_spthermo = right.m_spthermo; m_tlast = -1.0; @@ -113,13 +131,12 @@ namespace Cantera { return *this; } - + //==================================================================================================================== VPSSMgr *VPSSMgr::duplMyselfAsVPSSMgr() const { VPSSMgr *vp = new VPSSMgr(*this); return vp; } - - + //==================================================================================================================== void VPSSMgr::initAllPtrs(VPStandardStateTP *vp_ptr, SpeciesThermo *sp_ptr) { m_vptp_ptr = vp_ptr; @@ -141,8 +158,7 @@ namespace Cantera { } } - - /*****************************************************************/ + //==================================================================================================================== // Standard States void diff --git a/Cantera/src/thermo/VPSSMgr.h b/Cantera/src/thermo/VPSSMgr.h index 9b2d913c2..b57751883 100644 --- a/Cantera/src/thermo/VPSSMgr.h +++ b/Cantera/src/thermo/VPSSMgr.h @@ -8,9 +8,9 @@ */ /* - * $Author: hkmoffa $ - * $Revision: 1.5 $ - * $Date: 2009/05/28 23:08:06 $ + * $Author$ + * $Revision$ + * $Date$ */ /* * Copywrite (2005) Sandia Corporation. Under the terms of @@ -772,11 +772,11 @@ namespace Cantera { const XML_Node * const phaseNode_ptr); - //! Initialize the internal pointers in this object + //! Initialize the internal shallow pointers in this object /*! * There are a bunch of internal shallow pointers that point to the owning * VPStandardStateTP and SpeciesThermo objects. This function reinitializes - * them. + * them. This function is called like an onion. * * @param vp_ptr Pointer to the VPStandardStateTP standard state * @param sp_ptr Poitner to the SpeciesThermo standard state diff --git a/Cantera/src/thermo/VPSSMgrFactory.cpp b/Cantera/src/thermo/VPSSMgrFactory.cpp index 0993635bb..6e3962fb6 100644 --- a/Cantera/src/thermo/VPSSMgrFactory.cpp +++ b/Cantera/src/thermo/VPSSMgrFactory.cpp @@ -6,7 +6,7 @@ * \link Cantera::VPSSMgrFactory VPSSMgrFactory\endlink); */ /* - * $Id: VPSSMgrFactory.cpp,v 1.8 2009/03/04 01:01:57 hkmoffa Exp $ + * $Id$ */ /* @@ -114,6 +114,10 @@ namespace Cantera { } else if (ssModel == "constant_incompressible" || ssModel == "constantVolume") { has_nasa_constVol++; + } else if (ssModel == "temperature_polynomial" || + ssModel == "density_temperature_polynomial" || + ssModel == "constant") { + has_other++; } else { throw UnknownVPSSMgrModel("getVPSSMgrTypes:", spNode->attrib("name")); @@ -126,6 +130,10 @@ namespace Cantera { } else if (ssModel == "constant_incompressible" || ssModel == "constantVolume") { has_shomate_constVol++; + } else if (ssModel == "temperature_polynomial" || + ssModel == "density_temperature_polynomial" || + ssModel == "constant") { + has_other++; } else { throw UnknownVPSSMgrModel("getVPSSMgrTypes:", spNode->attrib("name")); @@ -138,6 +146,10 @@ namespace Cantera { } else if (ssModel == "constant_incompressible" || ssModel == "constantVolume") { has_simple_constVol++; + } else if (ssModel == "temperature_polynomial" || + ssModel == "density_temperature_polynomial" || + ssModel == "constant") { + has_other++; } else { throw UnknownVPSSMgrModel("getVPSSMgrTypes:", spNode->attrib("name")); diff --git a/Cantera/src/thermo/VPSSMgrFactory.h b/Cantera/src/thermo/VPSSMgrFactory.h index 9d55d7957..5683608b3 100644 --- a/Cantera/src/thermo/VPSSMgrFactory.h +++ b/Cantera/src/thermo/VPSSMgrFactory.h @@ -6,8 +6,8 @@ */ /* - * $Revision: 1.5 $ - * $Date: 2009/02/11 20:03:08 $ + * $Revision$ + * $Date$ */ /* diff --git a/Cantera/src/thermo/VPSSMgr_ConstVol.cpp b/Cantera/src/thermo/VPSSMgr_ConstVol.cpp index bf05a8640..12bc083be 100644 --- a/Cantera/src/thermo/VPSSMgr_ConstVol.cpp +++ b/Cantera/src/thermo/VPSSMgr_ConstVol.cpp @@ -12,9 +12,9 @@ * U.S. Government retains certain rights in this software. */ /* - * $Author: hkmoffa $ - * $Date: 2009/05/28 23:08:06 $ - * $Revision: 1.4 $ + * $Author$ + * $Date$ + * $Revision$ */ // turn off warnings under Windows diff --git a/Cantera/src/thermo/VPSSMgr_ConstVol.h b/Cantera/src/thermo/VPSSMgr_ConstVol.h index 14a867530..52ead4294 100644 --- a/Cantera/src/thermo/VPSSMgr_ConstVol.h +++ b/Cantera/src/thermo/VPSSMgr_ConstVol.h @@ -6,9 +6,9 @@ * \link Cantera::VPSSMgr_ConstVol VPSSMgr_ConstVol \endlink). */ /* - * $Author: hkmoffa $ - * $Revision: 1.3 $ - * $Date: 2009/05/28 23:08:06 $ + * $Author$ + * $Revision$ + * $Date$ */ /* * Copywrite (2005) Sandia Corporation. Under the terms of diff --git a/Cantera/src/thermo/VPSSMgr_General.cpp b/Cantera/src/thermo/VPSSMgr_General.cpp index 043310b8a..442eeda59 100644 --- a/Cantera/src/thermo/VPSSMgr_General.cpp +++ b/Cantera/src/thermo/VPSSMgr_General.cpp @@ -12,9 +12,9 @@ * U.S. Government retains certain rights in this software. */ /* - * $Author: hkmoffa $ - * $Date: 2009/05/28 23:08:06 $ - * $Revision: 1.5 $ + * $Author$ + * $Date$ + * $Revision$ */ // turn off warnings under Windows @@ -30,6 +30,7 @@ #include "PDSS_IdealGas.h" #include "PDSS_Water.h" #include "PDSS_ConstVol.h" +#include "PDSS_SSVol.h" #include "PDSS_HKFT.h" #include "PDSS_IonsFromNeutral.h" #include "GeneralSpeciesThermo.h" @@ -62,12 +63,23 @@ namespace Cantera { m_useTmpRefStateStorage = true; *this = right; } - - + //==================================================================================================================== VPSSMgr_General& VPSSMgr_General::operator=(const VPSSMgr_General &b) { - if (&b == this) return *this; + if (&b == this) { + return *this; + } VPSSMgr::operator=(b); + /* + * Must fill in the shallow pointers. These must have already been transfered + * and storred in the owning VPStandardStateTP class. Note we are aware that at this point + * m_vptr_ptr may refer back to the wrong ThermoPhase object. However, the shallow copy + * performed here is consistent with the assignment operator's general functionality. + */ + m_PDSS_ptrs.resize(m_kk); + for (int k = 0; k < m_kk; k++) { + m_PDSS_ptrs[k] = m_vptp_ptr->providePDSS(k); + } return *this; } @@ -75,8 +87,29 @@ namespace Cantera { VPSSMgr_General *vpm = new VPSSMgr_General(*this); return (VPSSMgr *) vpm; } - - + //==================================================================================================================== + // Initialize the internal shallow pointers in this object + /* + * There are a bunch of internal shallow pointers that point to the owning + * VPStandardStateTP and SpeciesThermo objects. This function reinitializes + * them. This function is called like an onion. + * + * @param vp_ptr Pointer to the VPStandardStateTP standard state + * @param sp_ptr Poitner to the SpeciesThermo standard state + */ + void VPSSMgr_General::initAllPtrs(VPStandardStateTP *vp_ptr, SpeciesThermo *sp_ptr) + { + VPSSMgr::initAllPtrs(vp_ptr, sp_ptr); + /* + * Must fill in the shallow pointers. These must have already been transfered + * and storred in the owning VPStandardStateTP class. + */ + m_PDSS_ptrs.resize(m_kk); + for (int k = 0; k < m_kk; k++) { + m_PDSS_ptrs[k] = m_vptp_ptr->providePDSS(k); + } + } + //==================================================================================================================== void VPSSMgr_General::_updateRefStateThermo() const { if (m_useTmpRefStateStorage) { @@ -159,6 +192,9 @@ namespace Cantera { if (model == "constant_incompressible") { VPSSMgr::installSTSpecies(k, speciesNode, phaseNode_ptr); kPDSS = new PDSS_ConstVol(m_vptp_ptr, k, speciesNode, *phaseNode_ptr, true); + if (!kPDSS) { + throw CanteraError("VPSSMgr_General::returnPDSS_ptr", "new PDSS_ConstVol failed"); + } } else if (model == "waterIAPWS" || model == "waterPDSS") { // VPSSMgr::installSTSpecies(k, speciesNode, phaseNode_ptr); kPDSS = new PDSS_Water(m_vptp_ptr, 0); @@ -190,6 +226,12 @@ namespace Cantera { } genSpthermo->installPDSShandler(k, kPDSS, this); + } else if (model == "constant" || model == "temperature_polynomial" || model == "density_temperature_polynomial") { + VPSSMgr::installSTSpecies(k, speciesNode, phaseNode_ptr); + kPDSS = new PDSS_SSVol(m_vptp_ptr, k, speciesNode, *phaseNode_ptr, true); + if (!kPDSS) { + throw CanteraError("VPSSMgr_General::returnPDSS_ptr", "new PDSS_SSVol failed"); + } } else { throw CanteraError("VPSSMgr_General::returnPDSS_ptr", "unknown standard state formulation: " + model); diff --git a/Cantera/src/thermo/VPSSMgr_General.h b/Cantera/src/thermo/VPSSMgr_General.h index 32e2011d2..fe43a307b 100644 --- a/Cantera/src/thermo/VPSSMgr_General.h +++ b/Cantera/src/thermo/VPSSMgr_General.h @@ -7,8 +7,8 @@ * class \link Cantera::VPSSMgr_General VPSSMgr_General\endlink). */ /* - * $Revision: 1.4 $ - * $Date: 2009/05/28 23:08:06 $ + * $Revision$ + * $Date$ */ /* * Copywrite (2007) Sandia Corporation. Under the terms of @@ -266,8 +266,18 @@ namespace Cantera { */ virtual VPSSMgr_enumType reportVPSSMgrType() const ; - - protected: + //! Initialize the internal shallow pointers in this object + /*! + * There are a bunch of internal shallow pointers that point to the owning + * VPStandardStateTP and SpeciesThermo objects. This function reinitializes + * them. This function is called like an onion. + * + * @param vp_ptr Pointer to the VPStandardStateTP standard state + * @param sp_ptr Poitner to the SpeciesThermo standard state + */ + virtual void initAllPtrs(VPStandardStateTP *vp_ptr, SpeciesThermo *sp_ptr); + + private: //! Shallow pointers containing the PDSS objects for the species //! in this phase. @@ -276,7 +286,6 @@ namespace Cantera { */ std::vector m_PDSS_ptrs; - private: //! VPStandardStateTP has its own err routine /*! diff --git a/Cantera/src/thermo/VPSSMgr_IdealGas.cpp b/Cantera/src/thermo/VPSSMgr_IdealGas.cpp index 7eedbc033..34ef28457 100644 --- a/Cantera/src/thermo/VPSSMgr_IdealGas.cpp +++ b/Cantera/src/thermo/VPSSMgr_IdealGas.cpp @@ -12,9 +12,9 @@ * U.S. Government retains certain rights in this software. */ /* - * $Author: hkmoffa $ - * $Date: 2009/05/28 23:08:06 $ - * $Revision: 1.3 $ + * $Author$ + * $Date$ + * $Revision$ */ // turn off warnings under Windows diff --git a/Cantera/src/thermo/VPSSMgr_IdealGas.h b/Cantera/src/thermo/VPSSMgr_IdealGas.h index ee123a3aa..146fa3e0a 100644 --- a/Cantera/src/thermo/VPSSMgr_IdealGas.h +++ b/Cantera/src/thermo/VPSSMgr_IdealGas.h @@ -7,9 +7,9 @@ * class \link Cantera::VPSSMgr_IdealGas VPSSMgr_IdealGas\endlink). */ /* - * $Author: hkmoffa $ - * $Revision: 1.3 $ - * $Date: 2009/05/28 23:08:06 $ + * $Author$ + * $Revision$ + * $Date$ */ /* diff --git a/Cantera/src/thermo/VPSSMgr_Water_ConstVol.cpp b/Cantera/src/thermo/VPSSMgr_Water_ConstVol.cpp index 5a156420a..40a65a8eb 100644 --- a/Cantera/src/thermo/VPSSMgr_Water_ConstVol.cpp +++ b/Cantera/src/thermo/VPSSMgr_Water_ConstVol.cpp @@ -15,8 +15,8 @@ */ /* - * $Date: 2009/05/28 23:08:06 $ - * $Revision: 1.9 $ + * $Date$ + * $Revision$ */ // turn off warnings under Windows diff --git a/Cantera/src/thermo/VPSSMgr_Water_ConstVol.h b/Cantera/src/thermo/VPSSMgr_Water_ConstVol.h index 7d8a248de..057a1d6f9 100644 --- a/Cantera/src/thermo/VPSSMgr_Water_ConstVol.h +++ b/Cantera/src/thermo/VPSSMgr_Water_ConstVol.h @@ -9,8 +9,8 @@ */ /* - * $Revision: 1.7 $ - * $Date: 2009/05/28 23:08:06 $ + * $Revision$ + * $Date$ */ /* diff --git a/Cantera/src/thermo/VPSSMgr_Water_HKFT.cpp b/Cantera/src/thermo/VPSSMgr_Water_HKFT.cpp index ac725e84b..0b33cdd63 100644 --- a/Cantera/src/thermo/VPSSMgr_Water_HKFT.cpp +++ b/Cantera/src/thermo/VPSSMgr_Water_HKFT.cpp @@ -15,8 +15,8 @@ */ /* - * $Date: 2009/05/28 23:08:06 $ - * $Revision: 1.13 $ + * $Date$ + * $Revision$ */ // turn off warnings under Windows diff --git a/Cantera/src/thermo/VPSSMgr_Water_HKFT.h b/Cantera/src/thermo/VPSSMgr_Water_HKFT.h index d54d7dd99..462eae89c 100644 --- a/Cantera/src/thermo/VPSSMgr_Water_HKFT.h +++ b/Cantera/src/thermo/VPSSMgr_Water_HKFT.h @@ -8,8 +8,8 @@ */ /* - * $Revision: 1.7 $ - * $Date: 2009/05/28 23:08:06 $ + * $Revision$ + * $Date$ */ /* diff --git a/Cantera/src/thermo/VPSSMgr_types.h b/Cantera/src/thermo/VPSSMgr_types.h index 9d7512563..4d55e1eff 100644 --- a/Cantera/src/thermo/VPSSMgr_types.h +++ b/Cantera/src/thermo/VPSSMgr_types.h @@ -8,9 +8,9 @@ * class \link Cantera::VPSSMgr VPSSMgr\endlink). */ /* - * $Author: hkmoffa $ - * $Revision: 1.1 $ - * $Date: 2008/08/23 00:53:55 $ + * $Author$ + * $Revision$ + * $Date$ */ /* * Copywrite (2005) Sandia Corporation. Under the terms of diff --git a/Cantera/src/thermo/VPStandardStateTP.cpp b/Cantera/src/thermo/VPStandardStateTP.cpp index 6a79674aa..8331f6d86 100644 --- a/Cantera/src/thermo/VPStandardStateTP.cpp +++ b/Cantera/src/thermo/VPStandardStateTP.cpp @@ -11,9 +11,9 @@ * U.S. Government retains certain rights in this software. */ /* - * $Author: hkmoffa $ - * $Date: 2009/01/04 06:34:20 $ - * $Revision: 1.16 $ + * $Author$ + * $Date$ + * $Revision$ */ // turn off warnings under Windows @@ -60,7 +60,7 @@ namespace Cantera { m_P0(OneAtm), m_VPSS_ptr(0) { - *this = b; + VPStandardStateTP::operator=(b); } /* @@ -85,9 +85,9 @@ namespace Cantera { m_Plast_ss = b.m_Plast_ss; m_P0 = b.m_P0; - - - // copy the pdss objects + /* + * Duplicate the pdss objects + */ if (m_PDSS_storage.size() > 0) { for (int k = 0; k < (int) m_PDSS_storage.size(); k++) { delete(m_PDSS_storage[k]); @@ -99,21 +99,36 @@ namespace Cantera { m_PDSS_storage[k] = ptmp->duplMyselfAsPDSS(); } + /* + * Duplicate the VPSS Manager object that conducts the calculations + */ if (m_VPSS_ptr) { delete m_VPSS_ptr; m_VPSS_ptr = 0; } m_VPSS_ptr = (b.m_VPSS_ptr)->duplMyselfAsVPSSMgr(); - m_VPSS_ptr->initAllPtrs(this, m_spthermo); + /* + * The VPSSMgr object contains shallow pointers. Whenever you have shallow + * pointers, they have to be fixed up to point to the correct objects refering + * back to this ThermoPhase's properties. + */ + m_VPSS_ptr->initAllPtrs(this, m_spthermo); + /* + * The PDSS objects contains shallow pointers. Whenever you have shallow + * pointers, they have to be fixed up to point to the correct objects refering + * back to this ThermoPhase's properties. This function also sets m_VPSS_ptr + * so it occurs after m_VPSS_ptr is set. + */ for (int k = 0; k < m_kk; k++) { - PDSS *ptmp = b.m_PDSS_storage[k]; + PDSS *ptmp = m_PDSS_storage[k]; ptmp->initAllPtrs(this, m_VPSS_ptr, m_spthermo); } + } return *this; } - + //==================================================================================================================== /* * ~VPStandardStateTP(): (virtual) * diff --git a/Cantera/src/thermo/VPStandardStateTP.h b/Cantera/src/thermo/VPStandardStateTP.h index f9097565d..4faed6a10 100644 --- a/Cantera/src/thermo/VPStandardStateTP.h +++ b/Cantera/src/thermo/VPStandardStateTP.h @@ -14,8 +14,8 @@ * U.S. Government retains certain rights in this software. */ /* - * $Date: 2009/03/27 00:38:57 $ - * $Revision: 1.20 $ + * $Date$ + * $Revision$ */ #ifndef CT_VPSTANDARDSTATETP_H @@ -120,10 +120,31 @@ namespace Cantera { */ virtual int standardStateConvention() const; - //@} + //! Get the array of log concentration-like derivatives of the + //! log activity coefficients + /*! + * This function is a virtual method. For ideal mixtures + * (unity activity coefficients), this can return zero. + * Implementations should take the derivative of the + * logarithm of the activity coefficient with respect to the + * logarithm of the concentration-like variable (i.e. mole fraction, + * molality, etc.) that represents the standard state. + * This quantity is to be used in conjunction with derivatives of + * that concentration-like variable when the derivative of the chemical + * potential is taken. + * + * units = dimensionless + * + * @param dlnActCoeffdlnC Output vector of derivatives of the + * log Activity Coefficients. length = m_kk + */ + virtual void getdlnActCoeffdlnC(doublereal *dlnActCoeffdlnC) const { + err("getdlnActCoeffdlnC"); + } - /// @name Partial Molar Properties of the Solution (VPStandardStateTP) + //@} + /// @name Partial Molar Properties of the Solution (VPStandardStateTP) //@{ diff --git a/Cantera/src/thermo/WaterProps.cpp b/Cantera/src/thermo/WaterProps.cpp index 662fed741..0e0777882 100644 --- a/Cantera/src/thermo/WaterProps.cpp +++ b/Cantera/src/thermo/WaterProps.cpp @@ -7,7 +7,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: WaterProps.cpp,v 1.9 2008/12/17 17:04:47 hkmoffa Exp $ + * $Id$ */ //@{ @@ -495,12 +495,13 @@ namespace Cantera { // Parameters for the viscosityWater() function - + //@{ + //! parameter const double H[4] = {1., 0.978197, 0.579829, -0.202354}; - + //! parameter const double Hij[6][7] = { { 0.5132047, 0.2151778, -0.2818107, 0.1778064, -0.04176610, 0., 0.}, @@ -514,7 +515,7 @@ namespace Cantera { const double rhoStar = 317.763; // kg / m3 const double presStar = 22.115E6; // Pa const double muStar = 55.071E-6; //Pa s - + //@} // Returns the viscosity of water at the current conditions // (kg/m/s) diff --git a/Cantera/src/thermo/WaterProps.h b/Cantera/src/thermo/WaterProps.h index f3ca51cbb..b6099f7df 100644 --- a/Cantera/src/thermo/WaterProps.h +++ b/Cantera/src/thermo/WaterProps.h @@ -11,7 +11,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: WaterProps.h,v 1.5 2008/08/23 00:53:55 hkmoffa Exp $ + * $Id$ */ #ifndef CT_WATERPROPS_H diff --git a/Cantera/src/thermo/WaterPropsIAPWS.cpp b/Cantera/src/thermo/WaterPropsIAPWS.cpp index 652bbda7a..0a7a83f9c 100644 --- a/Cantera/src/thermo/WaterPropsIAPWS.cpp +++ b/Cantera/src/thermo/WaterPropsIAPWS.cpp @@ -2,7 +2,7 @@ * @file WaterPropsIAPWS.cpp * Definitions for a class for calculating the equation of state of water * from the IAPWS 1995 Formulation based on the steam tables thermodynamic - * basis (See class \link WaterPropsIAPWS WaterPropsIAPWS\endlink). + * basis (See class \link Cantera::WaterPropsIAPWS WaterPropsIAPWS\endlink). */ /* * Copywrite (2006) Sandia Corporation. Under the terms of @@ -10,7 +10,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: WaterPropsIAPWS.cpp,v 1.17 2008/12/17 17:01:29 hkmoffa Exp $ + * $Id$ */ #include "WaterPropsIAPWS.h" diff --git a/Cantera/src/thermo/WaterPropsIAPWS.h b/Cantera/src/thermo/WaterPropsIAPWS.h index 003441167..b3c722b1d 100644 --- a/Cantera/src/thermo/WaterPropsIAPWS.h +++ b/Cantera/src/thermo/WaterPropsIAPWS.h @@ -2,7 +2,7 @@ * @file WaterPropsIAPWS.h * Headers for a class for calculating the equation of state of water * from the IAPWS 1995 Formulation based on the steam tables thermodynamic - * basis (See class \link WaterPropsIAPWS WaterPropsIAPWS\endlink). + * basis (See class \link Cantera::WaterPropsIAPWS WaterPropsIAPWS\endlink). */ /* * Copywrite (2005) Sandia Corporation. Under the terms of @@ -10,7 +10,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: WaterPropsIAPWS.h,v 1.16 2008/09/29 20:03:57 hkmoffa Exp $ + * $Id$ */ #ifndef WATERPROPSIAPWS_H diff --git a/Cantera/src/thermo/WaterPropsIAPWSphi.cpp b/Cantera/src/thermo/WaterPropsIAPWSphi.cpp index c8ee6dcfc..d91bce64b 100644 --- a/Cantera/src/thermo/WaterPropsIAPWSphi.cpp +++ b/Cantera/src/thermo/WaterPropsIAPWSphi.cpp @@ -1,7 +1,7 @@ /** * @file WaterPropsIAPWSphi.cpp * Definitions for Lowest level of the classes which support a real water model - * (see class #WaterPropsIAPWS and class #WaterPropsIAPWSphi). + * (see class \link Cantera::WaterPropsIAPWS WaterPropsIAPWS\endlink and class #WaterPropsIAPWSphi). */ /* * Copywrite (2006) Sandia Corporation. Under the terms of @@ -9,7 +9,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: WaterPropsIAPWSphi.cpp,v 1.12 2008/12/29 22:53:36 hkmoffa Exp $ + * $Id$ */ #include "WaterPropsIAPWSphi.h" diff --git a/Cantera/src/thermo/WaterPropsIAPWSphi.h b/Cantera/src/thermo/WaterPropsIAPWSphi.h index 7bdf45ca2..1691214ae 100644 --- a/Cantera/src/thermo/WaterPropsIAPWSphi.h +++ b/Cantera/src/thermo/WaterPropsIAPWSphi.h @@ -1,7 +1,7 @@ /** * @file WaterPropsIAPWSphi.h * Header for Lowest level of the classes which support a real water model - * (see class #WaterPropsIAPWS and class #WaterPropsIAPWSphi). + * (see class \link Cantera::WaterPropsIAPWS WaterPropsIAPWS\endlink and class \link WaterPropsIAPWSphi WaterPropsIAPWSphi\endlink). * * This class calculates dimensionless quantitites. */ @@ -11,7 +11,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: WaterPropsIAPWSphi.h,v 1.8 2008/09/12 21:51:04 hkmoffa Exp $ + * $Id$ */ #ifndef WATERPROPSIAPWSPHI_H diff --git a/Cantera/src/thermo/WaterSSTP.cpp b/Cantera/src/thermo/WaterSSTP.cpp index af1922645..863d96803 100644 --- a/Cantera/src/thermo/WaterSSTP.cpp +++ b/Cantera/src/thermo/WaterSSTP.cpp @@ -9,7 +9,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: WaterSSTP.cpp,v 1.17 2009/03/27 00:38:58 hkmoffa Exp $ + * $Id$ */ #include "xml.h" diff --git a/Cantera/src/thermo/WaterSSTP.h b/Cantera/src/thermo/WaterSSTP.h index bbc46b18a..b4add6b2f 100644 --- a/Cantera/src/thermo/WaterSSTP.h +++ b/Cantera/src/thermo/WaterSSTP.h @@ -9,7 +9,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: WaterSSTP.h,v 1.13 2009/03/27 00:38:58 hkmoffa Exp $ + * $Id$ */ #ifndef CT_WATERSSTP_H diff --git a/Cantera/src/thermo/electrolytes.h b/Cantera/src/thermo/electrolytes.h index 97bf75bef..eecd6f878 100644 --- a/Cantera/src/thermo/electrolytes.h +++ b/Cantera/src/thermo/electrolytes.h @@ -10,7 +10,7 @@ * U.S. Government retains certain rights in this software. */ /* - * $Id: electrolytes.h,v 1.1 2006/07/06 15:41:15 hkmoffa Exp $ + * $Id$ */ #ifndef CT_ELECTROLYTES_H #define CT_ELECTROLYTES_H diff --git a/Cantera/src/thermo/mix_defs.h b/Cantera/src/thermo/mix_defs.h old mode 100755 new mode 100644 index 05954fada..adee9aeba --- a/Cantera/src/thermo/mix_defs.h +++ b/Cantera/src/thermo/mix_defs.h @@ -83,11 +83,29 @@ namespace Cantera { const int cVPSS_DebyeHuckel = 1050; const int cVPSS_MolalSoln = 1060; + //! Types of general formulations for the specification of the standard state volume + enum SSVolume_Model_enumType { + //! This approximation is for a constant volume + cSSVOLUME_CONSTANT = 0, + //! This approximation is for a species with a quadratic polynomial in temperature + /*! + * V^ss_i = ai + bi T + ci T2 + */ + cSSVOLUME_TPOLY, + //! This approximation is for a species where the density is expressed as a + //! quadratic polynomial in temperature + /*! + * V^ss_i = M_i / (ai + bi T + ci T2) + */ + cSSVOLUME_DENSITY_TPOLY + }; + //! Types of PDSS's enum PDSS_enumType { cPDSS_UNDEF = 100, cPDSS_IDEALGAS, cPDSS_CONSTVOL, + cPDSS_SSVOL, cPDSS_MOLAL_CONSTVOL, cPDSS_WATER, cPDSS_MOLAL_HKFT, diff --git a/Cantera/src/thermo/phasereport.cpp b/Cantera/src/thermo/phasereport.cpp index 8a5830d6c..af3dfdacc 100644 --- a/Cantera/src/thermo/phasereport.cpp +++ b/Cantera/src/thermo/phasereport.cpp @@ -4,8 +4,8 @@ */ /* - * $Date: 2009/01/14 22:46:33 $ - * $Revision: 1.8 $ + * $Date$ + * $Revision$ * * Copyright 2001 California Institute of Technology * diff --git a/Cantera/src/thermo/speciesThermoTypes.h b/Cantera/src/thermo/speciesThermoTypes.h index 2e570ba5b..f8e742821 100755 --- a/Cantera/src/thermo/speciesThermoTypes.h +++ b/Cantera/src/thermo/speciesThermoTypes.h @@ -4,9 +4,9 @@ * reference-state thermodynamics managers (see \ref spthermo) */ /* - * $Author: hkmoffa $ - * $Revision: 1.6 $ - * $Date: 2008/09/29 20:03:57 $ + * $Author$ + * $Revision$ + * $Date$ */ // Copyright 2001 California Institute of Technology