Style changes to be consistent with the rest of Cantera.

Thanks for the code review.
This commit is contained in:
Victor Brunini 2014-03-13 16:49:10 +00:00
parent df908229b1
commit e62ce054ce
4 changed files with 21 additions and 20 deletions

View file

@ -3273,7 +3273,7 @@ private:
void calc_lambdas(double is) const;
//! Track the last ionic strength lambdas were calculated at to avoid unnecessarily recalculating them
mutable double last_is;
mutable double m_last_is;
/**
* Calculate etheta and etheta_prime

View file

@ -297,9 +297,9 @@ protected:
bool _updateThermo() const;
//! Vector containing the last computed activity coefficients at T = m_tlast and r = last_r
mutable std::vector<doublereal> last_ac;
mutable std::vector<doublereal> m_last_ac;
//! Last value of r used to update activity coeffs
mutable doublereal last_r;
mutable doublereal m_last_mole_frac_product;
//! Vector containing the species reference enthalpies at T = m_tlast
mutable vector_fp m_h0_RT;

View file

@ -73,7 +73,7 @@ HMWSoln::HMWSoln() :
CROP_ln_gamma_o_max(3.0),
CROP_ln_gamma_k_min(-5.0),
CROP_ln_gamma_k_max(15.0),
last_is(-1.0),
m_last_is(-1.0),
m_debugCalc(0)
{
for (size_t i = 0; i < 17; i++) {
@ -127,7 +127,7 @@ HMWSoln::HMWSoln(const std::string& inputFile, const std::string& id_) :
CROP_ln_gamma_o_max(3.0),
CROP_ln_gamma_k_min(-5.0),
CROP_ln_gamma_k_max(15.0),
last_is(-1.0),
m_last_is(-1.0),
m_debugCalc(0)
{
for (int i = 0; i < 17; i++) {
@ -182,7 +182,7 @@ HMWSoln::HMWSoln(XML_Node& phaseRoot, const std::string& id_) :
CROP_ln_gamma_o_max(3.0),
CROP_ln_gamma_k_min(-5.0),
CROP_ln_gamma_k_max(15.0),
last_is(-1.0),
m_last_is(-1.0),
m_debugCalc(0)
{
for (int i = 0; i < 17; i++) {
@ -237,7 +237,7 @@ HMWSoln::HMWSoln(const HMWSoln& b) :
CROP_ln_gamma_o_max(3.0),
CROP_ln_gamma_k_min(-5.0),
CROP_ln_gamma_k_max(15.0),
last_is(-1.0),
m_last_is(-1.0),
m_debugCalc(0)
{
/*
@ -451,7 +451,7 @@ HMWSoln::HMWSoln(int testProb) :
CROP_ln_gamma_o_max(3.0),
CROP_ln_gamma_k_min(-5.0),
CROP_ln_gamma_k_max(15.0),
last_is(-1.0),
m_last_is(-1.0),
m_debugCalc(0)
{
if (testProb != 1) {
@ -5465,7 +5465,9 @@ void HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP() const
void HMWSoln::calc_lambdas(double is) const
{
const double tol = 1.e-12;
if( std::abs(is - last_is) < tol ) return;
if( std::abs(is - m_last_is) < tol ) {
return;
}
double aphi, dj, jfunc, jprime, t, x, zprod;
int i, ij, j;
@ -5524,7 +5526,7 @@ void HMWSoln::calc_lambdas(double is) const
#endif
}
}
last_is = is;
m_last_is = is;
}
void HMWSoln::calc_thetas(int z1, int z2,

View file

@ -23,8 +23,8 @@ namespace Cantera
MaskellSolidSolnPhase::MaskellSolidSolnPhase() :
m_Pref(OneAtm),
m_Pcurrent(OneAtm),
last_ac(2),
last_r(-1.0),
m_last_ac(2),
m_last_mole_frac_product(-1.0),
m_h0_RT(2),
m_cp0_R(2),
m_g0_RT(2),
@ -38,8 +38,8 @@ MaskellSolidSolnPhase::MaskellSolidSolnPhase() :
MaskellSolidSolnPhase::MaskellSolidSolnPhase(const MaskellSolidSolnPhase& b) :
m_Pref(OneAtm),
m_Pcurrent(OneAtm),
last_ac(2),
last_r(-1.0),
m_last_ac(2),
m_last_mole_frac_product(-1.0),
m_h0_RT(2),
m_cp0_R(2),
m_g0_RT(2),
@ -160,8 +160,7 @@ getActivityCoefficients(doublereal* ac) const
bool temp_changed = _updateThermo();
const doublereal r = moleFraction(product_species_index);
const doublereal tol = 1.e-12;
if( temp_changed || std::abs(r - last_r) > tol )
{
if( temp_changed || std::abs(r - m_last_mole_frac_product) > tol ) {
const doublereal pval = p(r);
const doublereal fmval = fm(r);
const doublereal rfm = r * fmval;
@ -169,11 +168,11 @@ getActivityCoefficients(doublereal* ac) const
const doublereal A = (std::pow(1 - rfm, pval) * std::pow(rfm, pval) * std::pow(r - rfm, 1 - pval)) /
(std::pow(1 - r - rfm, 1 + pval) * (1 - r));
const doublereal B = pval * h_mixing / RT;
last_ac[product_species_index] = A * std::exp(B);
last_ac[reactant_species_index] = 1 / (A * r * (1-r) ) * std::exp(-B);
last_r = r;
m_last_ac[product_species_index] = A * std::exp(B);
m_last_ac[reactant_species_index] = 1 / (A * r * (1-r) ) * std::exp(-B);
m_last_mole_frac_product = r;
}
std::copy(last_ac.begin(), last_ac.end(), ac);
std::copy(m_last_ac.begin(), m_last_ac.end(), ac);
}
void MaskellSolidSolnPhase::