24 GibbsExcessVPSSTP::GibbsExcessVPSSTP(
const GibbsExcessVPSSTP& b)
26 GibbsExcessVPSSTP::operator=(b);
29 GibbsExcessVPSSTP& GibbsExcessVPSSTP::operator=(
const GibbsExcessVPSSTP& b)
35 VPStandardStateTP::operator=(b);
37 moleFractions_ = b.moleFractions_;
38 lnActCoeff_Scaled_ = b.lnActCoeff_Scaled_;
39 dlnActCoeffdT_Scaled_ = b.dlnActCoeffdT_Scaled_;
40 d2lnActCoeffdT2_Scaled_ = b.d2lnActCoeffdT2_Scaled_;
41 dlnActCoeffdlnX_diag_ = b.dlnActCoeffdlnX_diag_;
42 dlnActCoeffdlnN_diag_ = b.dlnActCoeffdlnN_diag_;
43 dlnActCoeffdlnN_ = b.dlnActCoeffdlnN_;
48 ThermoPhase* GibbsExcessVPSSTP::duplMyselfAsThermoPhase()
const 53 void GibbsExcessVPSSTP::compositionChanged()
55 Phase::compositionChanged();
56 getMoleFractions(moleFractions_.data());
61 void GibbsExcessVPSSTP::calcDensity()
63 vector_fp vbar = getPartialMolarVolumesVector();
64 doublereal vtotal = 0.0;
65 for (
size_t i = 0; i < m_kk; i++) {
66 vtotal += vbar[i] * moleFractions_[i];
68 doublereal dd = meanMolecularWeight() / vtotal;
69 Phase::setDensity(dd);
73 void GibbsExcessVPSSTP::getActivityConcentrations(doublereal* c)
const 78 doublereal GibbsExcessVPSSTP::standardConcentration(
size_t k)
const 83 doublereal GibbsExcessVPSSTP::logStandardConc(
size_t k)
const 88 void GibbsExcessVPSSTP::getActivities(doublereal* ac)
const 90 getActivityCoefficients(ac);
91 getMoleFractions(moleFractions_.data());
92 for (
size_t k = 0; k < m_kk; k++) {
93 ac[k] *= moleFractions_[k];
97 void GibbsExcessVPSSTP::getActivityCoefficients(doublereal*
const ac)
const 99 getLnActivityCoefficients(ac);
100 for (
size_t k = 0; k < m_kk; k++) {
103 }
else if (ac[k] < -700.) {
113 void GibbsExcessVPSSTP::getPartialMolarVolumes(doublereal* vbar)
const 116 getStandardVolumes(vbar);
119 const vector_fp& GibbsExcessVPSSTP::getPartialMolarVolumesVector()
const 121 return getStandardVolumes();
124 double GibbsExcessVPSSTP::checkMFSum(
const doublereal*
const x)
const 126 doublereal norm = std::accumulate(x, x + m_kk, 0.0);
127 if (fabs(norm - 1.0) > 1.0E-9) {
129 "(MF sum - 1) exceeded tolerance of 1.0E-9: {}", norm);
134 bool GibbsExcessVPSSTP::addSpecies(shared_ptr<Species> spec)
136 bool added = VPStandardStateTP::addSpecies(spec);
139 moleFractions_.push_back(1.0);
141 moleFractions_.push_back(0.0);
143 lnActCoeff_Scaled_.push_back(0.0);
144 dlnActCoeffdT_Scaled_.push_back(0.0);
145 d2lnActCoeffdT2_Scaled_.push_back(0.0);
146 dlnActCoeffdlnX_diag_.push_back(0.0);
147 dlnActCoeffdlnN_diag_.push_back(0.0);
148 dlnActCoeffdlnN_.resize(m_kk, m_kk);
Base class for a phase with thermodynamic properties.
Header for intermediate ThermoPhase object for phases which employ Gibbs excess free energy based for...
Base class for exceptions thrown by Cantera classes.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Contains declarations for string manipulation functions within Cantera.
Namespace for the Cantera kernel.