Changed the name of getLNActivityCoefficient to getLnActivityCoefficient

Doxygen updates
This commit is contained in:
Harry Moffat 2010-08-06 20:09:58 +00:00
parent 2af06f0e79
commit b216c194aa
4 changed files with 99 additions and 41 deletions

View file

@ -39,7 +39,7 @@ using namespace std;
namespace Cantera {
static const double xxSmall = 1.0E-150;
//====================================================================================================================
/*
* Default constructor.
*
@ -54,11 +54,14 @@ namespace Cantera {
numAnionSpecies_(0),
numPassThroughSpecies_(0),
neutralMoleculePhase_(0),
IOwnNThermoPhase_(true)
IOwnNThermoPhase_(true),
moleFractionsTmp_(0),
muNeutralMolecule_(0),
lnActCoeff_NeutralMolecule_(0)
{
}
//====================================================================================================================
// Construct and initialize an IonsFromNeutralVPSSTP object
// directly from an asci input file
/*
@ -95,14 +98,17 @@ namespace Cantera {
numAnionSpecies_(0),
numPassThroughSpecies_(0),
neutralMoleculePhase_(neutralPhase),
IOwnNThermoPhase_(true)
IOwnNThermoPhase_(true),
moleFractionsTmp_(0),
muNeutralMolecule_(0),
lnActCoeff_NeutralMolecule_(0)
{
if (neutralPhase) {
IOwnNThermoPhase_ = false;
}
constructPhaseFile(inputFile, id);
}
//====================================================================================================================
IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(XML_Node& phaseRoot, std::string id,
ThermoPhase *neutralPhase) :
GibbsExcessVPSSTP(),
@ -114,7 +120,11 @@ namespace Cantera {
numAnionSpecies_(0),
numPassThroughSpecies_(0),
neutralMoleculePhase_(neutralPhase),
IOwnNThermoPhase_(true)
IOwnNThermoPhase_(true),
moleFractionsTmp_(0),
muNeutralMolecule_(0),
lnActCoeff_NeutralMolecule_(0)
{
if (neutralPhase) {
IOwnNThermoPhase_ = false;
@ -122,7 +132,7 @@ namespace Cantera {
constructPhaseXML(phaseRoot, id);
}
//====================================================================================================================
/*
* Copy Constructor:
@ -140,11 +150,15 @@ namespace Cantera {
numAnionSpecies_(0),
numPassThroughSpecies_(0),
neutralMoleculePhase_(0),
IOwnNThermoPhase_(true)
IOwnNThermoPhase_(true),
moleFractionsTmp_(0),
muNeutralMolecule_(0),
lnActCoeff_NeutralMolecule_(0)
{
IonsFromNeutralVPSSTP::operator=(b);
}
//====================================================================================================================
/*
* operator=()
*
@ -196,10 +210,12 @@ namespace Cantera {
IOwnNThermoPhase_ = b.IOwnNThermoPhase_;
moleFractionsTmp_ = b.moleFractionsTmp_;
muNeutralMolecule_ = b.muNeutralMolecule_;
gammaNeutralMolecule_ = b.gammaNeutralMolecule_;
// gammaNeutralMolecule_ = b.gammaNeutralMolecule_;
lnActCoeff_NeutralMolecule_ = b.lnActCoeff_NeutralMolecule_;
dlnActCoeffdT_NeutralMolecule_ = b.dlnActCoeffdT_NeutralMolecule_;
dlnActCoeffdlnX_diag_NeutralMolecule_ = b.dlnActCoeffdlnX_diag_NeutralMolecule_;
dlnActCoeffdlnN_diag_NeutralMolecule_ = b.dlnActCoeffdlnN_diag_NeutralMolecule_;
dlnActCoeffdlnN_NeutralMolecule_ = b.dlnActCoeffdlnN_NeutralMolecule_;
return *this;
}
@ -472,7 +488,8 @@ namespace Cantera {
neutralMoleculePhase_->getChemPotentials(mu);
break;
case cIonSolnType_SINGLEANION:
neutralMoleculePhase_->getActivityCoefficients(DATA_PTR(gammaNeutralMolecule_));
// neutralMoleculePhase_->getActivityCoefficients(DATA_PTR(gammaNeutralMolecule_));
neutralMoleculePhase_->getLnActivityCoefficients(DATA_PTR(lnActCoeff_NeutralMolecule_));
fact2 = 2.0 * RT_ * log(2.0);
@ -482,7 +499,7 @@ namespace Cantera {
icat = cationList_[k];
jNeut = fm_invert_ionForNeutral[icat];
xx = fmaxx(SmallNumber, moleFractions_[icat]);
mu[icat] = muNeutralMolecule_[jNeut] + fact2 + RT_ * log(gammaNeutralMolecule_[jNeut] * xx);
mu[icat] = muNeutralMolecule_[jNeut] + fact2 + RT_ * (lnActCoeff_NeutralMolecule_[jNeut] + log(xx));
}
// Do the anion list
@ -496,7 +513,7 @@ namespace Cantera {
icat = passThroughList_[k];
jNeut = fm_invert_ionForNeutral[icat];
xx = fmaxx(SmallNumber, moleFractions_[icat]);
mu[icat] = muNeutralMolecule_[jNeut] + RT_ * log( gammaNeutralMolecule_[jNeut] * xx);
mu[icat] = muNeutralMolecule_[jNeut] + RT_ * (lnActCoeff_NeutralMolecule_[jNeut] + log(xx));
}
break;
@ -1156,7 +1173,7 @@ namespace Cantera {
}
//====================================================================================================================
/*
* @internal Initialize. This method is provided to allow
* subclasses to perform any initialization required after all
@ -1174,7 +1191,7 @@ namespace Cantera {
initLengths();
GibbsExcessVPSSTP::initThermo();
}
//====================================================================================================================
// Initialize lengths of local variables after all species have
// been identified.
@ -1190,7 +1207,7 @@ namespace Cantera {
passThroughList_.resize(m_kk);
moleFractionsTmp_.resize(m_kk);
muNeutralMolecule_.resize(numNeutralMoleculeSpecies_);
gammaNeutralMolecule_.resize(numNeutralMoleculeSpecies_);
lnActCoeff_NeutralMolecule_.resize(numNeutralMoleculeSpecies_);
dlnActCoeffdT_NeutralMolecule_.resize(numNeutralMoleculeSpecies_);
dlnActCoeffdlnX_diag_NeutralMolecule_.resize(numNeutralMoleculeSpecies_);
dlnActCoeffdlnN_diag_NeutralMolecule_.resize(numNeutralMoleculeSpecies_);
@ -1399,7 +1416,7 @@ namespace Cantera {
/*
* Get the activity coefficiens of the neutral molecules
*/
neutralMoleculePhase_->getActivityCoefficients(DATA_PTR(gammaNeutralMolecule_));
neutralMoleculePhase_->getLnActivityCoefficients(DATA_PTR(lnActCoeff_NeutralMolecule_));
switch (ionSolnType_) {
case cIonSolnType_PASSTHROUGH:
@ -1412,7 +1429,7 @@ namespace Cantera {
icat = cationList_[k];
jNeut = fm_invert_ionForNeutral[icat];
fmij = fm_neutralMolec_ions_[icat + jNeut * m_kk];
lnActCoeff_Scaled_[icat] = log(gammaNeutralMolecule_[jNeut])/fmij;
lnActCoeff_Scaled_[icat] = lnActCoeff_NeutralMolecule_[jNeut] / fmij;
}
// Do the anion list
@ -1424,7 +1441,7 @@ namespace Cantera {
for (k = 0; k < numPassThroughSpecies_; k++) {
icat = passThroughList_[k];
jNeut = fm_invert_ionForNeutral[icat];
lnActCoeff_Scaled_[icat] = log(gammaNeutralMolecule_[jNeut]);
lnActCoeff_Scaled_[icat] = lnActCoeff_NeutralMolecule_[jNeut];
}
break;

View file

@ -892,9 +892,36 @@ namespace Cantera {
//! Temporary mole fraction vector
mutable std::vector<doublereal> moleFractionsTmp_;
//! Storage vector for the neutral molecule chemical potentials
/*!
* This vector is used as a temporary storage area when calculating the ion chemical
* potentials.
*
* Units = Joules/kmol
* Length = numNeutralMoleculeSpecies_
*/
mutable std::vector<doublereal> muNeutralMolecule_;
mutable std::vector<doublereal> gammaNeutralMolecule_;
mutable std::vector<doublereal> dlnActCoeff_NeutralMolecule_;
//! Storage vector for the neutral molecule activity coefficients
/*!
* This vector is used as a temporary storage area when calculating the ion chemical
* potentials and activity coefficients
*
* Units = none
* Length = numNeutralMoleculeSpecies_
*/
// mutable std::vector<doublereal> gammaNeutralMolecule_;
//! Storage vector for the neutral molecule ln activity coefficients
/*!
* This vector is used as a temporary storage area when calculating the ion chemical
* potentials and activity coefficients
*
* Units = none
* Length = numNeutralMoleculeSpecies_
*/
mutable std::vector<doublereal> lnActCoeff_NeutralMolecule_;
mutable std::vector<doublereal> dlnActCoeffdT_NeutralMolecule_;
mutable std::vector<doublereal> dlnActCoeffdlnX_diag_NeutralMolecule_;
mutable std::vector<doublereal> dlnActCoeffdlnN_diag_NeutralMolecule_;

View file

@ -135,7 +135,7 @@ namespace Cantera {
m_ssConvention = right.m_ssConvention;
return *this;
}
//====================================================================================================================
//====================================================================================================================
/*
* Duplication routine for objects which inherit from
* ThermoPhase.
@ -151,45 +151,42 @@ namespace Cantera {
ThermoPhase* tp = new ThermoPhase(*this);
return tp;
}
//====================================================================================================================
//====================================================================================================================
int ThermoPhase::activityConvention() const {
return cAC_CONVENTION_MOLAR;
}
//=================================================================================================================
int ThermoPhase::standardStateConvention() const {
return m_ssConvention;
}
//=================================================================================================================
doublereal ThermoPhase::logStandardConc(int k) const {
return log(standardConcentration(k));
}
//=================================================================================================================
void ThermoPhase::getActivities(doublereal* a) const {
getActivityConcentrations(a);
int nsp = nSpecies();
int k;
for (k = 0; k < nsp; k++) a[k] /= standardConcentration(k);
}
void ThermoPhase::getLNActivityCoefficients(doublereal *const lnac) const {
//=================================================================================================================
void ThermoPhase::getLnActivityCoefficients(doublereal *const lnac) const {
getActivityCoefficients(lnac);
for (int k = 0; k < m_kk; k++) {
lnac[k] = std::log(lnac[k]);
}
}
void ThermoPhase::setState_TPX(doublereal t, doublereal p,
const doublereal* x) {
//=================================================================================================================
void ThermoPhase::setState_TPX(doublereal t, doublereal p, const doublereal* x) {
setMoleFractions(x); setTemperature(t); setPressure(p);
}
void ThermoPhase::setState_TPX(doublereal t, doublereal p,
compositionMap& x) {
//=================================================================================================================
void ThermoPhase::setState_TPX(doublereal t, doublereal p, compositionMap& x) {
setMoleFractionsByName(x); setTemperature(t); setPressure(p);
}
void ThermoPhase::setState_TPX(doublereal t, doublereal p,
const std::string& x) {
//=================================================================================================================
void ThermoPhase::setState_TPX(doublereal t, doublereal p, const std::string& x) {
compositionMap xx;
int kk = nSpecies();
for (int k = 0; k < kk; k++) xx[speciesName(k)] = -1.0;
@ -202,17 +199,17 @@ namespace Cantera {
}
setMoleFractionsByName(xx); setTemperature(t); setPressure(p);
}
//=================================================================================================================
void ThermoPhase::setState_TPY(doublereal t, doublereal p,
const doublereal* y) {
setMassFractions(y); setTemperature(t); setPressure(p);
}
//=================================================================================================================
void ThermoPhase::setState_TPY(doublereal t, doublereal p,
compositionMap& y) {
setMassFractionsByName(y); setTemperature(t); setPressure(p);
}
//=================================================================================================================
void ThermoPhase::setState_TPY(doublereal t, doublereal p,
const std::string& y) {
compositionMap yy;
@ -227,28 +224,34 @@ namespace Cantera {
}
setMassFractionsByName(yy); setTemperature(t); setPressure(p);
}
//=================================================================================================================
void ThermoPhase::setState_TP(doublereal t, doublereal p) {
setTemperature(t); setPressure(p);
}
//=================================================================================================================
void ThermoPhase::setState_PX(doublereal p, doublereal* x) {
setMoleFractions(x); setPressure(p);
}
//=================================================================================================================
void ThermoPhase::setState_PY(doublereal p, doublereal* y) {
setMassFractions(y); setPressure(p);
}
//=================================================================================================================
void ThermoPhase::setState_HP(doublereal Htarget, doublereal p,
doublereal dTtol) {
setState_HPorUV(Htarget, p, dTtol, false);
}
//=================================================================================================================
void ThermoPhase::setState_UV(doublereal u, doublereal v,
doublereal dTtol) {
setState_HPorUV(u, v, dTtol, true);
}
//=================================================================================================================
// Do the convergence work
/*
@ -513,16 +516,19 @@ namespace Cantera {
throw CanteraError("setState_HPorUV (HP)", ErrString);
}
}
//=================================================================================================================
void ThermoPhase::setState_SP(doublereal Starget, doublereal p,
doublereal dTtol) {
setState_SPorSV(Starget, p, dTtol, false);
}
//=================================================================================================================
void ThermoPhase::setState_SV(doublereal Starget, doublereal v,
doublereal dTtol) {
setState_SPorSV(Starget, v, dTtol, true);
}
//=================================================================================================================
// Do the convergence work for fixed entropy situations
/*
@ -772,6 +778,7 @@ namespace Cantera {
throw CanteraError("setState_SPorSV (SP)", ErrString);
}
}
//=================================================================================================================
doublereal ThermoPhase::err(std::string msg) const {
throw CanteraError("ThermoPhase","Base class method "
@ -816,6 +823,7 @@ namespace Cantera {
if (i == 5) uA[5] = 0.0;
}
}
//=================================================================================================================
/*
* initThermoFile():
@ -861,6 +869,7 @@ namespace Cantera {
initThermoXML(*fxml_phase, id);
delete fxml;
}
//=================================================================================================================
/*
* Import and initialize a ThermoPhase object

View file

@ -1153,7 +1153,12 @@ namespace Cantera {
}
}
virtual void getLNActivityCoefficients(doublereal * const lnac) const;
//! 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.
*/
virtual void getLnActivityCoefficients(doublereal * const lnac) const;
//@}
/// @name Partial Molar Properties of the Solution