diff --git a/Cantera/src/thermo/IonsFromNeutralVPSSTP.h b/Cantera/src/thermo/IonsFromNeutralVPSSTP.h
index 7f4886b1b..787b305df 100644
--- a/Cantera/src/thermo/IonsFromNeutralVPSSTP.h
+++ b/Cantera/src/thermo/IonsFromNeutralVPSSTP.h
@@ -384,6 +384,8 @@ namespace Cantera {
* \bar h_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT}
* \f]
*
+ * @param hbar Output vector of species partial molar enthalpies.
+ * Length: m_kk. Units: J/kmol
*/
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;
@@ -401,6 +403,10 @@ namespace Cantera {
* - R \ln( \gamma_k X_k)
* - R T \frac{d \ln(\gamma_k) }{dT}
* \f]
+ *
+ *
+ * @param sbar Output vector of species partial molar entropies.
+ * Length: m_kk. Units: J/kmol/K
*/
virtual void getPartialMolarEntropies(doublereal* sbar) const;
diff --git a/Cantera/src/thermo/PDSS_IonsFromNeutral.cpp b/Cantera/src/thermo/PDSS_IonsFromNeutral.cpp
index 28fa361de..2bf67b6a3 100644
--- a/Cantera/src/thermo/PDSS_IonsFromNeutral.cpp
+++ b/Cantera/src/thermo/PDSS_IonsFromNeutral.cpp
@@ -24,10 +24,8 @@
using namespace std;
namespace Cantera {
- /**
- * Basic list of constructors and duplicators
- */
-
+
+ //====================================================================================================================
PDSS_IonsFromNeutral::PDSS_IonsFromNeutral(VPStandardStateTP *tp, int spindex) :
PDSS(tp, spindex),
neutralMoleculePhase_(0),
@@ -128,15 +126,27 @@ namespace Cantera {
neutralMoleculePhase_ = ionPhase->neutralMoleculePhase_;
}
//====================================================================================================================
- /**
- * constructPDSSXML:
+ // 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.
*
- * Initialization of a PDSS_IonsFromNeutral object using an
- * xml file.
-
- * @param id Optional parameter identifying the name of the
- * phase. If none is given, the first XML
- * phase element will be used.
+ * @param spindex Species index within the phase
+ *
+ * @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.
*/
void PDSS_IonsFromNeutral::constructPDSSXML(VPStandardStateTP *tp, int spindex,
const XML_Node& speciesNode,
@@ -195,7 +205,25 @@ namespace Cantera {
}
//====================================================================================================================
-
+ // 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 PDSS_IonsFromNeutral::constructPDSSFile(VPStandardStateTP *tp, int spindex,
std::string inputFile, std::string id) {
@@ -233,11 +261,11 @@ namespace Cantera {
constructPDSSXML(tp, spindex, *s, *fxml_phase, id);
delete fxml;
}
-
+ //=======================================================================================================
void PDSS_IonsFromNeutral::initThermoXML(const XML_Node& phaseNode, std::string &id) {
PDSS::initThermoXML(phaseNode, id);
}
-
+ //=======================================================================================================
void PDSS_IonsFromNeutral::initThermo() {
PDSS::initThermo();
SpeciesThermo &sp = m_tp->speciesThermo();
@@ -245,8 +273,8 @@ namespace Cantera {
m_minTemp = m_spthermo->minTemp(m_spindex);
m_maxTemp = m_spthermo->maxTemp(m_spindex);
}
-
- /**
+ //=======================================================================================================
+ /*
* Return the molar enthalpy in units of J kmol-1
*/
doublereal
@@ -255,7 +283,7 @@ namespace Cantera {
doublereal RT = GasConstant * m_temp;
return (val * RT);
}
-
+ //=======================================================================================================
doublereal
PDSS_IonsFromNeutral::enthalpy_RT() const {
neutralMoleculePhase_->getEnthalpy_RT(DATA_PTR(tmpNM));
@@ -266,9 +294,8 @@ namespace Cantera {
}
return val;
}
-
-
- /**
+ //=======================================================================================================
+ /*
* Calculate the internal energy in mks units of
* J kmol-1
*/
@@ -278,8 +305,8 @@ namespace Cantera {
doublereal RT = GasConstant * m_temp;
return (val * RT);
}
-
- /**
+ //=======================================================================================================
+ /*
* Calculate the entropy in mks units of
* J kmol-1 K-1
*/
@@ -288,7 +315,7 @@ namespace Cantera {
doublereal val = entropy_R();
return (val * GasConstant);
}
-
+ //=======================================================================================================
doublereal
PDSS_IonsFromNeutral::entropy_R() const {
neutralMoleculePhase_->getEntropy_R(DATA_PTR(tmpNM));
@@ -302,8 +329,8 @@ namespace Cantera {
}
return val;
}
-
- /**
+ //=======================================================================================================
+ /*
* Calculate the Gibbs free energy in mks units of
* J kmol-1 K-1.
*/
@@ -313,7 +340,7 @@ namespace Cantera {
doublereal RT = GasConstant * m_temp;
return (val * RT);
}
-
+ //=======================================================================================================
doublereal
PDSS_IonsFromNeutral::gibbs_RT() const {
neutralMoleculePhase_->getGibbs_RT(DATA_PTR(tmpNM));
@@ -327,8 +354,8 @@ namespace Cantera {
}
return val;
}
-
- /**
+ //=======================================================================================================
+ /*
* Calculate the constant pressure heat capacity
* in mks units of J kmol-1 K-1
*/
@@ -337,7 +364,7 @@ namespace Cantera {
doublereal val = cp_R();
return (val * GasConstant);
}
-
+ //=======================================================================================================
doublereal
PDSS_IonsFromNeutral::cp_R() const {
neutralMoleculePhase_->getCp_R(DATA_PTR(tmpNM));
@@ -348,7 +375,7 @@ namespace Cantera {
}
return val;
}
-
+ //=======================================================================================================
doublereal
PDSS_IonsFromNeutral::molarVolume() const {
neutralMoleculePhase_->getStandardVolumes(DATA_PTR(tmpNM));
@@ -359,8 +386,7 @@ namespace Cantera {
}
return val;
}
-
-
+ //=======================================================================================================
doublereal
PDSS_IonsFromNeutral::density() const {
return (m_pres * m_mw / (GasConstant * m_temp));
@@ -375,7 +401,7 @@ namespace Cantera {
throw CanteraError("PDSS_IonsFromNeutral::cv_mole()", "unimplemented");
return 0.0;
}
-
+ //====================================================================================================================
doublereal
PDSS_IonsFromNeutral::gibbs_RT_ref() const {
@@ -390,7 +416,7 @@ namespace Cantera {
}
return val;
}
-
+ //====================================================================================================================
doublereal PDSS_IonsFromNeutral::enthalpy_RT_ref() const {
neutralMoleculePhase_->getEnthalpy_RT_ref(DATA_PTR(tmpNM));
doublereal val = 0.0;
@@ -400,7 +426,7 @@ namespace Cantera {
}
return val;
}
-
+ //====================================================================================================================
doublereal PDSS_IonsFromNeutral::entropy_R_ref() const {
neutralMoleculePhase_->getEntropy_R_ref(DATA_PTR(tmpNM));
doublereal val = 0.0;
@@ -413,7 +439,7 @@ namespace Cantera {
}
return val;
}
-
+ //====================================================================================================================
doublereal PDSS_IonsFromNeutral::cp_R_ref() const {
neutralMoleculePhase_->getCp_R_ref(DATA_PTR(tmpNM));
doublereal val = 0.0;
@@ -423,7 +449,7 @@ namespace Cantera {
}
return val;
}
-
+ //====================================================================================================================
doublereal PDSS_IonsFromNeutral::molarVolume_ref() const {
neutralMoleculePhase_->getStandardVolumes_ref(DATA_PTR(tmpNM));
doublereal val = 0.0;
@@ -433,7 +459,7 @@ namespace Cantera {
}
return val;
}
-
+ //====================================================================================================================
/*
* Calculate the pressure (Pascals), given the temperature and density
* Temperature: kelvin
@@ -442,31 +468,31 @@ namespace Cantera {
doublereal PDSS_IonsFromNeutral::pressure() const {
return m_pres;
}
-
+ //====================================================================================================================
void PDSS_IonsFromNeutral::setPressure(doublereal p) {
m_pres = p;
neutralMoleculePhase_->setPressure(p);
}
-
- /// critical temperature
+ //====================================================================================================================
+ // critical temperature
doublereal PDSS_IonsFromNeutral::critTemperature() const {
throw CanteraError("PDSS_IonsFromNeutral::critTemperature()", "unimplemented");
return (0.0);
}
-
- /// critical pressure
+ //====================================================================================================================
+ // critical pressure
doublereal PDSS_IonsFromNeutral::critPressure() const {
throw CanteraError("PDSS_IonsFromNeutral::critPressure()", "unimplemented");
return (0.0);
}
-
- /// critical density
+ //====================================================================================================================
+ // critical density
doublereal PDSS_IonsFromNeutral::critDensity() const {
throw CanteraError("PDSS_IonsFromNeutral::critDensity()", "unimplemented");
return (0.0);
}
-
+ //====================================================================================================================
/*
* Return the temperature
@@ -478,29 +504,30 @@ namespace Cantera {
m_temp = m_vpssmgr_ptr->temperature();
return m_temp;
}
-
+ //====================================================================================================================
void PDSS_IonsFromNeutral::setTemperature(doublereal temp) {
m_temp = temp;
neutralMoleculePhase_->setTemperature(temp);
}
-
+ //====================================================================================================================
void PDSS_IonsFromNeutral::setState_TP(doublereal temp, doublereal pres) {
m_pres = pres;
m_temp = temp;
neutralMoleculePhase_->setState_TP(temp, pres);
}
-
+ //====================================================================================================================
void PDSS_IonsFromNeutral::setState_TR(doublereal temp, doublereal rho) {
neutralMoleculePhase_->setState_TR(temp, rho);
}
-
- /// saturation pressure
+ //====================================================================================================================
+ // saturation pressure
doublereal PDSS_IonsFromNeutral::satPressure(doublereal t){
throw CanteraError("PDSS_IonsFromNeutral::satPressure()", "unimplemented");
/*NOTREACHED*/
return (0.0);
}
-
+ //====================================================================================================================
}
+//====================================================================================================================
diff --git a/Cantera/src/thermo/PDSS_IonsFromNeutral.h b/Cantera/src/thermo/PDSS_IonsFromNeutral.h
index 4b95fd6c2..06782b254 100644
--- a/Cantera/src/thermo/PDSS_IonsFromNeutral.h
+++ b/Cantera/src/thermo/PDSS_IonsFromNeutral.h
@@ -183,12 +183,21 @@ namespace Cantera {
*/
virtual doublereal gibbs_mole() const;
- //! Return the molar gibbs free energy divided by RT
+ //! Return the molar gibbs free energy divided by RT
/*!
- * Returns the species standard state gibbs free energy divided by RT at the
+ * 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
+ * \f[
+ * \frac{\mu^o_k}{RT} = \sum_{m}{ \alpha_{m , k} \frac{\mu^o_{m}}{RT}} + ( 1 - \delta_{k,sp}) 2.0 \ln{2.0}
+ * \f]
+ *
+ * m is the neutral molecule species index. \f$ \alpha_{m , k} \f$ is the stoiciometric
+ * coefficient for the neutral molecule, m, that creates the thermodynamics for the ionic species k.
+ * A factor \f$ 2.0 \ln{2.0} \f$ is added to all ions except for the species ionic species, which in this
+ * case is the single anion species, with species index sp.
+ *
+ * @return Returns the species standard state gibbs free energy divided by RT
*/
virtual doublereal gibbs_RT() const;
@@ -388,10 +397,9 @@ namespace Cantera {
void constructPDSSFile(VPStandardStateTP *vptp_ptr, int spindex,
std::string inputFile, std::string id);
- //!Initialization of a PDSS object using an xml tree
+ //! Initialization of a PDSS object using an xml tree
/*!
- * This routine is a driver for the initialization of the
- * object.
+ * This routine is a driver for the initialization of the object.
*
* basic logic:
* initThermo() (cascade)
@@ -403,6 +411,9 @@ namespace Cantera {
*
* @param spindex Species index within the phase
*
+ * @param speciesNode Reference to the phase Information for the species
+ * that this standard state refers to
+ *
* @param phaseNode Reference to the phase Information for the phase
* that owns this species.
*
@@ -461,16 +472,28 @@ namespace Cantera {
ThermoPhase *neutralMoleculePhase_;
public:
+
+ //! Number of neutral molecule species that make up the stoichiometric vector for
+ //! this species, in terms of calculating thermodynamic functions
int numMult_;
+ //! Vector of species indecises in the neutral molecule ThermoPhase
std::vector idNeutralMoleculeVec;
+ //! Stoichiometric coefficient for this species using the Neutral Molecule Species
+ //! in the vector idNeutralMoleculeVec
std::vector factorVec;
+ //! Add 2RTln2 to the entropy and Gibbs free energies for this species
+ /*!
+ * This is true if this species is not the special species
+ */
bool add2RTln2_;
+ //! Vector of length equal to the number of species in the neutral molecule phase
mutable std::vector tmpNM;
+ //! True if this species is the special species
int specialSpecies_;
};
}
diff --git a/Cantera/src/thermo/ThermoPhase.h b/Cantera/src/thermo/ThermoPhase.h
index 21ea9b1eb..8e35524d0 100644
--- a/Cantera/src/thermo/ThermoPhase.h
+++ b/Cantera/src/thermo/ThermoPhase.h
@@ -1156,7 +1156,7 @@ namespace Cantera {
//! Get the array of non-dimensional molar-based ln activity coefficients at
//! the current solution temperature, pressure, and solution concentration.
/*!
- * @param ac Output vector of ln activity coefficients. Length: m_kk.
+ * @param lnac Output vector of ln activity coefficients. Length: m_kk.
*/
virtual void getLnActivityCoefficients(doublereal * const lnac) const;
@@ -1975,6 +1975,8 @@ namespace Cantera {
//! Add in species from Slave phases
/*!
* This hook is used for cSS_CONVENTION_SLAVE phases
+ *
+ * @param phaseNode XML Element for the phase
*/
virtual void installSlavePhases(Cantera::XML_Node* phaseNode);
@@ -2076,45 +2078,43 @@ namespace Cantera {
err("getdlnActCoeffds");
}
- //! Get the array of log concentration-like derivatives of the
- //! log activity coefficients - diagonal component only
+ //! Get the array of ln mole fraction derivatives of the log activity coefficients - diagonal component only
/*!
* 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)
+ * logarithm of the mole fraction variable
* 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
+ * that mole fraction variable when the derivative of the chemical
* potential is taken.
*
* units = dimensionless
*
- * @param dlnActCoeffdln_diag Output vector of derivatives of the
- * log Activity Coefficients. length = m_kk
+ * @param dlnActCoeffdlnX_diag Output vector of derivatives of the
+ * log Activity Coefficients wrt the mole fractions. length = m_kk
*/
virtual void getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const {
err("getdlnActCoeffdlnX_diag");
}
- //! Get the array of log concentration-like derivatives of the
- //! log activity coefficients
+ //! Get the array of log species mole number 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. moles)
- * 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.
+ * 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. moles)
+ * that represents the standard state.
+ * This quantity is to be used in conjunction with derivatives of
+ * that species mole number variable when the derivative of the chemical
+ * potential is taken.
*
* units = dimensionless
*
* @param dlnActCoeffdlnN_diag Output vector of derivatives of the
- * log Activity Coefficients. length = m_kk
+ * log Activity Coefficients. length = m_kk
*/
virtual void getdlnActCoeffdlnN_diag(doublereal *dlnActCoeffdlnN_diag) const {
err("getdlnActCoeffdlnN_diag");