[Thermo] Remove unnecessary temporary work vectors

This commit is contained in:
Ray Speth 2016-04-18 17:52:08 -04:00
parent 9e9ae783f8
commit 6e3812a828
12 changed files with 19 additions and 64 deletions

View file

@ -148,9 +148,6 @@ protected:
//! Temporary storage for dimensionless reference state entropies //! Temporary storage for dimensionless reference state entropies
mutable vector_fp m_s0_R; mutable vector_fp m_s0_R;
//! Temporary array containing internally calculated partial pressures
mutable vector_fp m_pp;
//! Current pressure (Pa) //! Current pressure (Pa)
doublereal m_press; doublereal m_press;

View file

@ -1114,9 +1114,6 @@ protected:
//! Pointer to the water property calculator //! Pointer to the water property calculator
std::unique_ptr<WaterProps> m_waterProps; std::unique_ptr<WaterProps> m_waterProps;
//! Temporary array used in equilibrium calculations
mutable vector_fp m_pp;
//! vector of size m_kk, used as a temporary holding area. //! vector of size m_kk, used as a temporary holding area.
mutable vector_fp m_tmpV; mutable vector_fp m_tmpV;

View file

@ -277,9 +277,6 @@ protected:
* number of species m * number of species m
*/ */
mutable Array2D dlnActCoeffdlnN_; mutable Array2D dlnActCoeffdlnN_;
//! Temporary storage space that is fair game
mutable vector_fp m_pp;
}; };
} }

View file

@ -1983,9 +1983,6 @@ private:
//! Pointer to the water property calculator //! Pointer to the water property calculator
std::unique_ptr<WaterProps> m_waterProps; std::unique_ptr<WaterProps> m_waterProps;
//! Temporary array used in equilibrium calculations
mutable vector_fp m_pp;
//! vector of size m_kk, used as a temporary holding area. //! vector of size m_kk, used as a temporary holding area.
mutable vector_fp m_tmpV; mutable vector_fp m_tmpV;

View file

@ -454,9 +454,6 @@ public:
int IMS_typeCutoff_; int IMS_typeCutoff_;
private: private:
//! Temporary array used in equilibrium calculations
mutable vector_fp m_pp;
//! vector of size m_kk, used as a temporary holding area. //! vector of size m_kk, used as a temporary holding area.
mutable vector_fp m_tmpV; mutable vector_fp m_tmpV;

View file

@ -467,6 +467,7 @@ private:
mutable vector_fp y_; mutable vector_fp y_;
mutable vector_fp dlnActCoeff_NeutralMolecule_; mutable vector_fp dlnActCoeff_NeutralMolecule_;
mutable vector_fp dX_NeutralMolecule_; mutable vector_fp dX_NeutralMolecule_;
mutable vector_fp m_work; // length m_kk
//! If true then we own the underlying neutral Molecule Phase //! If true then we own the underlying neutral Molecule Phase
/*! /*!

View file

@ -28,7 +28,6 @@ ConstDensityThermo& ConstDensityThermo::operator=(const ConstDensityThermo& righ
m_cp0_R = right.m_cp0_R; m_cp0_R = right.m_cp0_R;
m_g0_RT = right.m_g0_RT; m_g0_RT = right.m_g0_RT;
m_s0_R = right.m_s0_R; m_s0_R = right.m_s0_R;
m_pp = right.m_pp;
return *this; return *this;
@ -117,7 +116,6 @@ bool ConstDensityThermo::addSpecies(shared_ptr<Species> spec)
m_g0_RT.push_back(0.0); m_g0_RT.push_back(0.0);
m_cp0_R.push_back(0.0); m_cp0_R.push_back(0.0);
m_s0_R.push_back(0.0); m_s0_R.push_back(0.0);
m_pp.push_back(0.0);
} }
return added; return added;
} }

View file

@ -121,7 +121,6 @@ DebyeHuckel& DebyeHuckel::operator=(const DebyeHuckel& b)
m_waterProps.reset(new WaterProps(m_waterSS)); m_waterProps.reset(new WaterProps(m_waterSS));
} }
m_pp = b.m_pp;
m_tmpV = b.m_tmpV; m_tmpV = b.m_tmpV;
m_speciesCharge_Stoich= b.m_speciesCharge_Stoich; m_speciesCharge_Stoich= b.m_speciesCharge_Stoich;
m_Beta_ij = b.m_Beta_ij; m_Beta_ij = b.m_Beta_ij;
@ -195,15 +194,8 @@ void DebyeHuckel::calcDensity()
// this for all other species if they had pressure dependent properties. // this for all other species if they had pressure dependent properties.
m_densWaterSS = m_waterSS->density(); m_densWaterSS = m_waterSS->density();
} }
double* vbar = &m_pp[0]; getPartialMolarVolumes(m_tmpV.data());
getPartialMolarVolumes(vbar); double dd = meanMolecularWeight() / mean_X(m_tmpV);
double* x = &m_tmpV[0];
getMoleFractions(x);
doublereal vtotal = 0.0;
for (size_t i = 0; i < m_kk; i++) {
vtotal += vbar[i] * x[i];
}
doublereal dd = meanMolecularWeight() / vtotal;
Phase::setDensity(dd); Phase::setDensity(dd);
} }
@ -939,7 +931,6 @@ bool DebyeHuckel::addSpecies(shared_ptr<Species> spec)
m_d2lnActCoeffMolaldT2.push_back(0.0); m_d2lnActCoeffMolaldT2.push_back(0.0);
m_dlnActCoeffMolaldP.push_back(0.0); m_dlnActCoeffMolaldP.push_back(0.0);
m_B_Dot.push_back(0.0); m_B_Dot.push_back(0.0);
m_pp.push_back(0.0);
m_tmpV.push_back(0.0); m_tmpV.push_back(0.0);
} }
return added; return added;

View file

@ -42,7 +42,6 @@ GibbsExcessVPSSTP& GibbsExcessVPSSTP::operator=(const GibbsExcessVPSSTP& b)
dlnActCoeffdlnX_diag_ = b.dlnActCoeffdlnX_diag_; dlnActCoeffdlnX_diag_ = b.dlnActCoeffdlnX_diag_;
dlnActCoeffdlnN_diag_ = b.dlnActCoeffdlnN_diag_; dlnActCoeffdlnN_diag_ = b.dlnActCoeffdlnN_diag_;
dlnActCoeffdlnN_ = b.dlnActCoeffdlnN_; dlnActCoeffdlnN_ = b.dlnActCoeffdlnN_;
m_pp = b.m_pp;
return *this; return *this;
} }
@ -148,7 +147,6 @@ bool GibbsExcessVPSSTP::addSpecies(shared_ptr<Species> spec)
dlnActCoeffdlnX_diag_.push_back(0.0); dlnActCoeffdlnX_diag_.push_back(0.0);
dlnActCoeffdlnN_diag_.push_back(0.0); dlnActCoeffdlnN_diag_.push_back(0.0);
dlnActCoeffdlnN_.resize(m_kk, m_kk); dlnActCoeffdlnN_.resize(m_kk, m_kk);
m_pp.push_back(0.0);
} }
return added; return added;
} }

View file

@ -239,7 +239,6 @@ HMWSoln& HMWSoln::operator=(const HMWSoln& b)
m_waterProps.reset(new WaterProps(dynamic_cast<PDSS_Water*>(m_waterSS))); m_waterProps.reset(new WaterProps(dynamic_cast<PDSS_Water*>(m_waterSS)));
} }
m_pp = b.m_pp;
m_tmpV = b.m_tmpV; m_tmpV = b.m_tmpV;
m_speciesCharge_Stoich= b.m_speciesCharge_Stoich; m_speciesCharge_Stoich= b.m_speciesCharge_Stoich;
m_Beta0MX_ij = b.m_Beta0MX_ij; m_Beta0MX_ij = b.m_Beta0MX_ij;
@ -396,7 +395,6 @@ int HMWSoln::eosType() const
doublereal HMWSoln::enthalpy_mole() const doublereal HMWSoln::enthalpy_mole() const
{ {
getPartialMolarEnthalpies(m_tmpV.data()); getPartialMolarEnthalpies(m_tmpV.data());
getMoleFractions(m_pp.data());
return mean_X(m_tmpV); return mean_X(m_tmpV);
} }
@ -496,15 +494,8 @@ void HMWSoln::calcDensity()
// Calculate all of the other standard volumes. Note these are constant for // Calculate all of the other standard volumes. Note these are constant for
// now // now
double* vbar = &m_pp[0]; getPartialMolarVolumes(m_tmpV.data());
getPartialMolarVolumes(vbar); double dd = meanMolecularWeight() / mean_X(m_tmpV);
double* x = &m_tmpV[0];
getMoleFractions(x);
doublereal vtotal = 0.0;
for (size_t i = 0; i < m_kk; i++) {
vtotal += vbar[i] * x[i];
}
doublereal dd = meanMolecularWeight() / vtotal;
Phase::setDensity(dd); Phase::setDensity(dd);
} }
@ -864,7 +855,6 @@ void HMWSoln::initLengths()
m_speciesSize.resize(m_kk); m_speciesSize.resize(m_kk);
m_speciesCharge_Stoich.resize(m_kk, 0.0); m_speciesCharge_Stoich.resize(m_kk, 0.0);
m_Aionic.resize(m_kk, 0.0); m_Aionic.resize(m_kk, 0.0);
m_pp.resize(m_kk, 0.0);
m_tmpV.resize(m_kk, 0.0); m_tmpV.resize(m_kk, 0.0);
m_molalitiesCropped.resize(m_kk, 0.0); m_molalitiesCropped.resize(m_kk, 0.0);

View file

@ -73,7 +73,6 @@ IdealMolalSoln& IdealMolalSoln::operator=(const IdealMolalSoln& b)
IMS_egCut_ = b.IMS_egCut_; IMS_egCut_ = b.IMS_egCut_;
IMS_agCut_ = b.IMS_agCut_; IMS_agCut_ = b.IMS_agCut_;
IMS_bgCut_ = b.IMS_bgCut_; IMS_bgCut_ = b.IMS_bgCut_;
m_pp = b.m_pp;
m_tmpV = b.m_tmpV; m_tmpV = b.m_tmpV;
IMS_lnActCoeffMolal_ = b.IMS_lnActCoeffMolal_; IMS_lnActCoeffMolal_ = b.IMS_lnActCoeffMolal_;
} }
@ -133,7 +132,6 @@ ThermoPhase* IdealMolalSoln::duplMyselfAsThermoPhase() const
doublereal IdealMolalSoln::enthalpy_mole() const doublereal IdealMolalSoln::enthalpy_mole() const
{ {
getPartialMolarEnthalpies(m_tmpV.data()); getPartialMolarEnthalpies(m_tmpV.data());
getMoleFractions(m_pp.data());
return mean_X(m_tmpV); return mean_X(m_tmpV);
} }
@ -165,15 +163,8 @@ doublereal IdealMolalSoln::cp_mole() const
void IdealMolalSoln::calcDensity() void IdealMolalSoln::calcDensity()
{ {
double* vbar = &m_pp[0]; getPartialMolarVolumes(m_tmpV.data());
getPartialMolarVolumes(vbar); doublereal dd = meanMolecularWeight() / mean_X(m_tmpV);
double* x = &m_tmpV[0];
getMoleFractions(x);
doublereal vtotal = 0.0;
for (size_t i = 0; i < m_kk; i++) {
vtotal += vbar[i] * x[i];
}
doublereal dd = meanMolecularWeight() / vtotal;
Phase::setDensity(dd); Phase::setDensity(dd);
} }
@ -397,7 +388,6 @@ bool IdealMolalSoln::addSpecies(shared_ptr<Species> spec)
{ {
bool added = MolalityVPSSTP::addSpecies(spec); bool added = MolalityVPSSTP::addSpecies(spec);
if (added) { if (added) {
m_pp.push_back(0.0);
m_speciesMolarVolume.push_back(0.0); m_speciesMolarVolume.push_back(0.0);
m_tmpV.push_back(0.0); m_tmpV.push_back(0.0);
IMS_lnActCoeffMolal_.push_back(0.0); IMS_lnActCoeffMolal_.push_back(0.0);

View file

@ -120,6 +120,7 @@ IonsFromNeutralVPSSTP::operator=(const IonsFromNeutralVPSSTP& b)
y_ = b.y_; y_ = b.y_;
dlnActCoeff_NeutralMolecule_ = b.dlnActCoeff_NeutralMolecule_; dlnActCoeff_NeutralMolecule_ = b.dlnActCoeff_NeutralMolecule_;
dX_NeutralMolecule_ = b.dX_NeutralMolecule_; dX_NeutralMolecule_ = b.dX_NeutralMolecule_;
m_work = b.m_work;
IOwnNThermoPhase_ = b.IOwnNThermoPhase_; IOwnNThermoPhase_ = b.IOwnNThermoPhase_;
moleFractionsTmp_ = b.moleFractionsTmp_; moleFractionsTmp_ = b.moleFractionsTmp_;
muNeutralMolecule_ = b.muNeutralMolecule_; muNeutralMolecule_ = b.muNeutralMolecule_;
@ -170,33 +171,33 @@ int IonsFromNeutralVPSSTP::eosType() const
doublereal IonsFromNeutralVPSSTP::enthalpy_mole() const doublereal IonsFromNeutralVPSSTP::enthalpy_mole() const
{ {
getPartialMolarEnthalpies(m_pp.data()); getPartialMolarEnthalpies(m_work.data());
return mean_X(m_pp); return mean_X(m_work);
} }
doublereal IonsFromNeutralVPSSTP::entropy_mole() const doublereal IonsFromNeutralVPSSTP::entropy_mole() const
{ {
getPartialMolarEntropies(m_pp.data()); getPartialMolarEntropies(m_work.data());
return mean_X(m_pp); return mean_X(m_work);
} }
doublereal IonsFromNeutralVPSSTP::gibbs_mole() const doublereal IonsFromNeutralVPSSTP::gibbs_mole() const
{ {
getChemPotentials(m_pp.data()); getChemPotentials(m_work.data());
return mean_X(m_pp); return mean_X(m_work);
} }
doublereal IonsFromNeutralVPSSTP::cp_mole() const doublereal IonsFromNeutralVPSSTP::cp_mole() const
{ {
getPartialMolarCp(m_pp.data()); getPartialMolarCp(m_work.data());
return mean_X(m_pp); return mean_X(m_work);
} }
doublereal IonsFromNeutralVPSSTP::cv_mole() const doublereal IonsFromNeutralVPSSTP::cv_mole() const
{ {
// Need to revisit this, as it is wrong // Need to revisit this, as it is wrong
getPartialMolarCp(m_pp.data()); getPartialMolarCp(m_work.data());
return mean_X(m_pp); return mean_X(m_work);
} }
// -- Activities, Standard States, Activity Concentrations ----------- // -- Activities, Standard States, Activity Concentrations -----------
@ -587,6 +588,7 @@ void IonsFromNeutralVPSSTP::initLengths()
y_.resize(numNeutralMoleculeSpecies_, 0.0); y_.resize(numNeutralMoleculeSpecies_, 0.0);
dlnActCoeff_NeutralMolecule_.resize(numNeutralMoleculeSpecies_, 0.0); dlnActCoeff_NeutralMolecule_.resize(numNeutralMoleculeSpecies_, 0.0);
dX_NeutralMolecule_.resize(numNeutralMoleculeSpecies_, 0.0); dX_NeutralMolecule_.resize(numNeutralMoleculeSpecies_, 0.0);
m_work.resize(m_kk);
} }
//! Return the factor overlap //! Return the factor overlap