changed the name of getdlnActcoeffdlnX to getdlnActCoeffdlnX_diag to

reflect what it is really doing.
This commit is contained in:
Harry Moffat 2010-08-04 16:06:14 +00:00
parent 3b8b18e72d
commit 7b063f3fc8
9 changed files with 45 additions and 119 deletions

View file

@ -39,7 +39,7 @@ namespace Cantera {
dlnActCoeffdT_Scaled_(0),
d2lnActCoeffdT2_Scaled_(0),
dlnActCoeffdlnN_diag_(0),
dlnActCoeffdlnX_Scaled_(0),
dlnActCoeffdlnX_diag_(0),
dlnActCoeffdN_Scaled_(0,0),
m_pp(0)
{
@ -58,7 +58,7 @@ namespace Cantera {
dlnActCoeffdT_Scaled_(0),
d2lnActCoeffdT2_Scaled_(0),
dlnActCoeffdlnN_diag_(0),
dlnActCoeffdlnX_Scaled_(0),
dlnActCoeffdlnX_diag_(0),
dlnActCoeffdN_Scaled_(0,0),
m_pp(0)
{
@ -83,7 +83,7 @@ namespace Cantera {
lnActCoeff_Scaled_ = b.lnActCoeff_Scaled_;
dlnActCoeffdT_Scaled_ = b.dlnActCoeffdT_Scaled_;
d2lnActCoeffdT2_Scaled_ = b.d2lnActCoeffdT2_Scaled_;
dlnActCoeffdlnX_Scaled_ = b.dlnActCoeffdlnX_Scaled_;
dlnActCoeffdlnX_diag_ = b.dlnActCoeffdlnX_diag_;
dlnActCoeffdlnN_diag_ = b.dlnActCoeffdlnN_diag_;
dlnActCoeffdN_Scaled_ = b.dlnActCoeffdN_Scaled_;
m_pp = b.m_pp;
@ -343,7 +343,7 @@ namespace Cantera {
lnActCoeff_Scaled_.resize(m_kk);
dlnActCoeffdT_Scaled_.resize(m_kk);
d2lnActCoeffdT2_Scaled_.resize(m_kk);
dlnActCoeffdlnX_Scaled_.resize(m_kk);
dlnActCoeffdlnX_diag_.resize(m_kk);
dlnActCoeffdlnN_diag_.resize(m_kk);
dlnActCoeffdN_Scaled_.resize(m_kk, m_kk);
m_pp.resize(m_kk);

View file

@ -304,50 +304,8 @@ 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 dlnActCoeffdlnN_diag Output vector of derivatives of the
* log Activity Coefficients. length = m_kk
*/
virtual void getdlnActCoeffdlnN_diag(doublereal *dlnActCoeffdlnN_diag) const {
err("getdlnActCoeffdlnN_diag");
}
//! 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. number of moles in
* in a unit volume. ) 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 derivatives of the
* log Activity Coefficients. length = m_kk
*/
virtual void getdlnActCoeffdlnX(doublereal *dlnActCoeffdlnX) const {
err("getdlnActCoeffdlnX");
}
//@}
/// @name Partial Molar Properties of the Solution
//@{
@ -576,7 +534,7 @@ namespace Cantera {
//! 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 @deprecated
mutable std::vector<doublereal> dlnActCoeffdlnX_Scaled_;
mutable std::vector<doublereal> dlnActCoeffdlnX_diag_;
//! Storage for the current derivative values of the gradients with respect to logarithm of the species mole number of the
//! log of the activity coefficients of the species

View file

@ -198,7 +198,7 @@ namespace Cantera {
muNeutralMolecule_ = b.muNeutralMolecule_;
gammaNeutralMolecule_ = b.gammaNeutralMolecule_;
dlnActCoeffdT_NeutralMolecule_ = b.dlnActCoeffdT_NeutralMolecule_;
dlnActCoeffdlnX_NeutralMolecule_ = b.dlnActCoeffdlnX_NeutralMolecule_;
dlnActCoeffdlnX_diag_NeutralMolecule_ = b.dlnActCoeffdlnX_diag_NeutralMolecule_;
dlnActCoeffdlnN_diag_NeutralMolecule_ = b.dlnActCoeffdlnN_diag_NeutralMolecule_;
return *this;
@ -593,9 +593,9 @@ namespace Cantera {
}
//! Get the array of log concentration-like derivatives of the
//! log activity coefficients
/*!
// 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
@ -612,12 +612,12 @@ namespace Cantera {
* derivatives of the log Activity Coefficients.
* length = m_kk
*/
void IonsFromNeutralVPSSTP::getdlnActCoeffdlnX(doublereal *dlnActCoeffdlnX) const {
void IonsFromNeutralVPSSTP::getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const {
s_update_lnActCoeff();
s_update_dlnActCoeff_dlnX();
s_update_dlnActCoeff_dlnX_diag();
for (int k = 0; k < m_kk; k++) {
dlnActCoeffdlnX[k] = dlnActCoeffdlnX_Scaled_[k];
dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k];
}
}
@ -1192,7 +1192,7 @@ namespace Cantera {
muNeutralMolecule_.resize(numNeutralMoleculeSpecies_);
gammaNeutralMolecule_.resize(numNeutralMoleculeSpecies_);
dlnActCoeffdT_NeutralMolecule_.resize(numNeutralMoleculeSpecies_);
dlnActCoeffdlnX_NeutralMolecule_.resize(numNeutralMoleculeSpecies_);
dlnActCoeffdlnX_diag_NeutralMolecule_.resize(numNeutralMoleculeSpecies_);
dlnActCoeffdlnN_diag_NeutralMolecule_.resize(numNeutralMoleculeSpecies_);
}
//====================================================================================================================
@ -1582,7 +1582,7 @@ 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_dlnX() const {
void IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX_diag() const {
int k, icat, jNeut;
doublereal fmij;
/*
@ -1590,11 +1590,11 @@ namespace Cantera {
*/
GibbsExcessVPSSTP *geThermo = dynamic_cast<GibbsExcessVPSSTP *>(neutralMoleculePhase_);
if (!geThermo) {
fvo_zero_dbl_1(dlnActCoeffdlnX_Scaled_, m_kk);
fvo_zero_dbl_1(dlnActCoeffdlnX_diag_, m_kk);
return;
}
geThermo->getdlnActCoeffdlnX(DATA_PTR(dlnActCoeffdlnX_NeutralMolecule_));
geThermo->getdlnActCoeffdlnX_diag(DATA_PTR(dlnActCoeffdlnX_diag_NeutralMolecule_));
switch (ionSolnType_) {
case cIonSolnType_PASSTHROUGH:
@ -1607,19 +1607,19 @@ namespace Cantera {
icat = cationList_[k];
jNeut = fm_invert_ionForNeutral[icat];
fmij = fm_neutralMolec_ions_[icat + jNeut * m_kk];
dlnActCoeffdlnX_Scaled_[icat] = dlnActCoeffdlnX_NeutralMolecule_[jNeut]/fmij;
dlnActCoeffdlnX_diag_[icat] = dlnActCoeffdlnX_diag_NeutralMolecule_[jNeut]/fmij;
}
// Do the anion list
icat = anionList_[0];
jNeut = fm_invert_ionForNeutral[icat];
dlnActCoeffdlnX_Scaled_[icat]= 0.0;
dlnActCoeffdlnX_diag_[icat]= 0.0;
// Do the list of neutral molecules
for (k = 0; k < numPassThroughSpecies_; k++) {
icat = passThroughList_[k];
jNeut = fm_invert_ionForNeutral[icat];
dlnActCoeffdlnX_Scaled_[icat] = dlnActCoeffdlnX_NeutralMolecule_[jNeut];
dlnActCoeffdlnX_diag_[icat] = dlnActCoeffdlnX_diag_NeutralMolecule_[jNeut];
}
break;

View file

@ -419,25 +419,21 @@ namespace Cantera {
doublereal *dlnActCoeffds) const;
//! Get the array of log concentration-like derivatives of the
//! log activity coefficients
//! log activity coefficients - diagonal component
/*!
* 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)
* 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.
* logarithm of the mole fraction.
*
* units = dimensionless
*
* @param dlnActCoeffdlnX Output vector of log(mole fraction)
* @param dlnActCoeffdlnX_diag Output vector of log(mole fraction)
* derivatives of the log Activity Coefficients.
* length = m_kk
*/
virtual void getdlnActCoeffdlnX(doublereal *dlnActCoeffdlnX) const;
virtual void getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const;
//! Get the array of log concentration-like derivatives of the
//! log activity coefficients - diagonal components
@ -744,7 +740,7 @@ namespace Cantera {
* derivative of the natural logarithm of the activity coefficients
* wrt logarithm of the mole fractions.
*/
void s_update_dlnActCoeff_dlnX() const;
void s_update_dlnActCoeff_dlnX_diag() const;
//! Update the derivative of the log of the activity coefficients
//! wrt log(number of moles) - diagonal components
@ -891,7 +887,7 @@ namespace Cantera {
mutable std::vector<doublereal> gammaNeutralMolecule_;
mutable std::vector<doublereal> dlnActCoeff_NeutralMolecule_;
mutable std::vector<doublereal> dlnActCoeffdT_NeutralMolecule_;
mutable std::vector<doublereal> dlnActCoeffdlnX_NeutralMolecule_;
mutable std::vector<doublereal> dlnActCoeffdlnX_diag_NeutralMolecule_;
mutable std::vector<doublereal> dlnActCoeffdlnN_diag_NeutralMolecule_;
};

View file

@ -989,13 +989,13 @@ namespace Cantera {
}
}
//====================================================================================================================
void MargulesVPSSTP::s_update_dlnActCoeff_dlnX() const {
void MargulesVPSSTP::s_update_dlnActCoeff_dlnX_diag() const {
int iA, iB;
doublereal XA, XB, g0 , g1;
doublereal T = temperature();
fvo_zero_dbl_1(dlnActCoeffdlnX_Scaled_, m_kk);
fvo_zero_dbl_1(dlnActCoeffdlnX_diag_, m_kk);
doublereal RT = GasConstant * T;
@ -1011,8 +1011,8 @@ namespace Cantera {
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;
dlnActCoeffdlnX_Scaled_[iA] += XA*XB*(2*g1*-2*g0-6*g1*XB);
dlnActCoeffdlnX_Scaled_[iB] += XA*XB*(2*g1*-2*g0-6*g1*XB);
dlnActCoeffdlnX_diag_[iA] += XA*XB*(2*g1*-2*g0-6*g1*XB);
dlnActCoeffdlnX_diag_[iB] += XA*XB*(2*g1*-2*g0-6*g1*XB);
}
}
@ -1024,10 +1024,10 @@ namespace Cantera {
}
}
//====================================================================================================================
void MargulesVPSSTP::getdlnActCoeffdlnX(doublereal *dlnActCoeffdlnX) const {
s_update_dlnActCoeff_dlnX();
void MargulesVPSSTP::getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const {
s_update_dlnActCoeff_dlnX_diag();
for (int k = 0; k < m_kk; k++) {
dlnActCoeffdlnX[k] = dlnActCoeffdlnX_Scaled_[k];
dlnActCoeffdlnX_diag[k] = dlnActCoeffdlnX_diag_[k];
}
}
//====================================================================================================================

View file

@ -794,25 +794,21 @@ namespace Cantera {
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
//! log activity coefficients - diagonal component
/*!
* 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.
* logarithm of the mole fraction.
*
* units = dimensionless
*
* @param dlnActCoeffdlnX Output vector of log(mole fraction)
* @param dlnActCoeffdlnX_diag Output vector of the diagonal component of the log(mole fraction)
* derivatives of the log Activity Coefficients.
* length = m_kk
*/
virtual void getdlnActCoeffdlnX(doublereal *dlnActCoeffdlnX) const;
virtual void getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const;
//! Get the array of derivatives of the log activity coefficients wrt mole numbers - diagonal only
/*!
@ -822,13 +818,10 @@ namespace Cantera {
* 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 the diagonal entries for the log(mole fraction)
* @param dlnActCoeffdlnN_diag Output vector of the diagonal entries for the log(mole fraction)
* derivatives of the log Activity Coefficients.
* length = m_kk
*/
@ -905,7 +898,7 @@ namespace Cantera {
* derivative of the natural logarithm of the activity coefficients
* wrt logarithm of the mole fractions.
*/
void s_update_dlnActCoeff_dlnX() const;
void s_update_dlnActCoeff_dlnX_diag() const;
//! Update the derivative of the log of the activity coefficients
//! wrt log(moles) - diagonal only

View file

@ -59,7 +59,8 @@ namespace Cantera {
m_spthermo = 0;
}
/**
//====================================================================================================================
/*
* Copy Constructor for the ThermoPhase object.
*
* Currently, this is implemented, but not tested. If called it will

View file

@ -2072,7 +2072,7 @@ namespace Cantera {
}
//! Get the array of log concentration-like derivatives of the
//! log activity coefficients
//! log activity coefficients - diagonal component only
/*!
* This function is a virtual method. For ideal mixtures
* (unity activity coefficients), this can return zero.
@ -2086,11 +2086,11 @@ namespace Cantera {
*
* units = dimensionless
*
* @param dlnActCoeffdlnX Output vector of derivatives of the
* @param dlnActCoeffdln_diag Output vector of derivatives of the
* log Activity Coefficients. length = m_kk
*/
virtual void getdlnActCoeffdlnX(doublereal *dlnActCoeffdlnX) const {
err("getdlnActCoeffdlnX");
virtual void getdlnActCoeffdlnX_diag(doublereal *dlnActCoeffdlnX_diag) const {
err("getdlnActCoeffdlnX_diag");
}
//! Get the array of log concentration-like derivatives of the

View file

@ -142,29 +142,7 @@ namespace Cantera {
err("getdlnActCoeffdlnN_diag");
}
//! 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)
* 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 derivatives of the
* log Activity Coefficients. length = m_kk
*/
virtual void getdlnActCoeffdlnX(doublereal *dlnActCoeffdlnX) const {
err("getdlnActCoeffdlnX");
}
//@}
/// @name Partial Molar Properties of the Solution (VPStandardStateTP)
//@{