diff --git a/Cantera/src/thermo/MargulesVPSSTP.cpp b/Cantera/src/thermo/MargulesVPSSTP.cpp index cd28e0497..8664a1ba9 100644 --- a/Cantera/src/thermo/MargulesVPSSTP.cpp +++ b/Cantera/src/thermo/MargulesVPSSTP.cpp @@ -612,9 +612,7 @@ namespace Cantera { * Get the standard state values in m^3 kmol-1 */ getStandardVolumes(vbar); - //cout << "species name(0) = " << speciesName(0) << endl; - //cout << "iA = " << speciesName(m_pSpecies_A_ij[0]) << endl; - //cout << "iB = " << speciesName(m_pSpecies_B_ij[0]) << endl; + for ( iK = 0; iK < m_kk; iK++ ){ delAK = 0; diff --git a/Cantera/src/thermo/MargulesVPSSTP.h b/Cantera/src/thermo/MargulesVPSSTP.h index 773cb7987..9ebfd9aa1 100644 --- a/Cantera/src/thermo/MargulesVPSSTP.h +++ b/Cantera/src/thermo/MargulesVPSSTP.h @@ -78,8 +78,10 @@ namespace Cantera { *

Specification of Solution Thermodynamic Properties

*
* - * The molar excess Gibbs free energy is given by the following formula which is a sum over interactions i. - * This is the generalization of the Margules formulation within a phase + * The molar excess Gibbs free energy is given by the following formula which is a sum over interactions i. + * Each of the interactions are binary interactions involving two of the species in the phase, denoted, Ai + * and Bi. + * This is the generalization of the Margules formulation for a phase * that has more than 2 species. * * \f[ @@ -103,44 +105,53 @@ namespace Cantera { * where * * \f[ - * R T \log( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} + * R T \ln( \gamma_k )= \frac{d(n G^E)}{d(n_k)}\Bigg|_{n_i} * \f] * - * where \f$ X_k \f$ is the mole fraction of species k. + * Taking the derivatives results in the following expression + * + * \f[ + * R T \ln( \gamma_k )= \sum_i \left( \left( \delta_{Ai,k} X_{Bi} + \delta_{Bi,k} X_{Ai} - X_{Ai} X_{Bi} \right) + * \left( g^E_{o,i} + g^E_{1,i} X_{Bi} \right) + + * \left( \delta_{Ai,k} - X_{Bi} \right) X_{Ai} X_{Bi} g^E_{1,i} \right) + * \f] + * where + * \f$ g^E_{o,i} = h_{o,i} - T s_{o,i} \f$ and \f$ g^E_{1,i} = h_{1,i} - T s_{1,i} \f$ + * and where \f$ X_k \f$ is the mole fraction of species k. + * + * This object inherits from the class VPStandardStateTP. Therefore, the specification and + * calculation of all standard state and reference state values are handled at that level. Various functional + * forms for the standard state are permissible. * The chemical potential for species k is equal to * * \f[ - * \mu_k(T,P) = \mu^o_k(T, P) + R T \log(\gamma_k X_k) - * \f] - * - * In terms of the reference state, the above can be rewritten - * - * \f[ - * \mu_k(T,P) = \mu^{ref}_k(T, P) + R T \log(\frac{P X_k}{P_{ref}}) + * \mu_k(T,P) = \mu^o_k(T, P) + R T \ln(\gamma_k X_k) * \f] * * The partial molar entropy for species k is given by the following relation, * * \f[ - * \tilde{s}_k(T,P) = s^o_k(T,P) - R \log(X_k) = s^{ref}_k(T) - R \log(\frac{P X_k}{P_{ref}}) + * \tilde{s}_k(T,P) = s^o_k(T,P) - R \ln( \gamma_k X_k ) + * - R T \frac{d \ln(\gamma_k) }{dT} * \f] * - * The partial molar enthalpy for species k is + * The partial molar enthalpy for species k is given by * * \f[ - * \tilde{h}_k(T,P) = h^o_k(T,P) = h^{ref}_k(T) + * \tilde{h}_k(T,P) = h^o_k(T,P) - R T^2 \frac{d \ln(\gamma_k)}{dT} * \f] * - * The partial molar Internal Energy for species k is + * The partial molar volume for species k is * * \f[ - * \tilde{u}_k(T,P) = u^o_k(T,P) = u^{ref}_k(T) + * \tilde V_k(T,P) = V^o_k(T,P) + R T \frac{d \ln(\gamma_k) }{dP} * \f] * * The partial molar Heat Capacity for species k is * * \f[ - * \tilde{Cp}_k(T,P) = Cp^o_k(T,P) = Cp^{ref}_k(T) + * \tilde{C}_{p,k}(T,P) = C^o_{p,k}(T,P) - 2 R T \frac{d \ln( \gamma_k )}{dT} + * - R T^2 \frac{d^2 \ln(\gamma_k) }{{dT}^2} * \f] * *
@@ -647,20 +658,6 @@ namespace Cantera { */ void getElectrochemPotentials(doublereal* mu) const; - //! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along - //! a line in parameter space or along a line in physical space - /*! - * - * @param dTds Input of temperature change along the path - * @param dXds Input vector of changes in mole fraction along the path. length = m_kk - * Along the path length it must be the case that the mole fractions sum to one. - * @param dlnActCoeffds Output vector of the directional derivatives of the - * log Activity Coefficients along the path. length = m_kk - * units are 1/units(s). if s is a physical coordinate then the units are 1/m. - */ - virtual void getdlnActCoeffds(const doublereal dTds, const doublereal * const dXds, doublereal *dlnActCoeffds) const; - - //! Get the array of temperature second derivatives of the log activity coefficients /*! * This function is a virtual class, but it first appears in GibbsExcessVPSSTP @@ -687,28 +684,6 @@ namespace Cantera { */ 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 dlnActCoeffdlnX Output vector of log(mole fraction) - * derivatives of the log Activity Coefficients. - * length = m_kk - */ - virtual void getdlnActCoeffdlnX(doublereal *dlnActCoeffdlnX) const; - virtual void getdlnActCoeffdlnN(doublereal *dlnActCoeffdlnN) const; //@} @@ -799,6 +774,70 @@ namespace Cantera { */ void initThermoXML(XML_Node& phaseNode, std::string id); + /** + * @} + * @name Derivatives of Thermodynamic Variables needed for Applications + * @{ + */ + + //! Get the change in activity coefficients w.r.t. change in state (temp, mole fraction, etc.) along + //! a line in parameter space or along a line in physical space + /*! + * + * @param dTds Input of temperature change along the path + * @param dXds Input vector of changes in mole fraction along the path. length = m_kk + * Along the path length it must be the case that the mole fractions sum to one. + * @param dlnActCoeffds Output vector of the directional derivatives of the + * log Activity Coefficients along the path. length = m_kk + * units are 1/units(s). if s is a physical coordinate then the units are 1/m. + */ + virtual void getdlnActCoeffds(const doublereal dTds, const doublereal * const dXds, doublereal *dlnActCoeffds) 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 dlnActCoeffdlnX Output vector of log(mole fraction) + * derivatives of the log Activity Coefficients. + * length = m_kk + */ + virtual void getdlnActCoeffdlnX(doublereal *dlnActCoeffdlnX) const; + virtual void getdlnActCoeffdlnN(doublereal *dlnActCoeffdlnN) const; + + + //! Get the array of derivatives of the log activity coefficients with respect to the species mole numbers + /*! + * Implementations should take the derivative of the logarithm of the activity coefficient with respect to a + * species mole number (with all other species mole numbers held constant) + * + * units = 1 / kmol + * + * dlnActCoeffdN[ ld * k + m] will contain the derivative of log act_coeff for the mth + * species with respect to the number of moles of the kth species. + * + * \f[ + * \frac{d \ln(\gamma_m) }{d n_k }\Bigg|_{n_i} + * \f] + * + * @param ld Number of rows in the matrix + * @param dlnActCoeffdN Output vector of derivatives of the + * log Activity Coefficients. length = m_kk * m_kk + */ + virtual void getdlnActCoeffdN(const int ld, doublereal * const dlnActCoeffdN) const { + err("getdlnActCoeffdN"); + } + //@} private: diff --git a/tools/doc/Cantera.cfg.in b/tools/doc/Cantera.cfg.in index 457ae6662..e796bec02 100755 --- a/tools/doc/Cantera.cfg.in +++ b/tools/doc/Cantera.cfg.in @@ -1655,7 +1655,7 @@ UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. -TEMPLATE_RELATIONS = YES +TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented @@ -1690,7 +1690,7 @@ CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. -GRAPHICAL_HIERARCHY = YES +GRAPHICAL_HIERARCHY = NO # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories