Get rid of static variables in member functions.
This commit is contained in:
parent
ea25de7fe7
commit
95e66cd5ff
10 changed files with 44 additions and 12 deletions
|
|
@ -423,6 +423,7 @@ public:
|
|||
* Length = m_kk. units are m^3/kmol.
|
||||
*/
|
||||
virtual void getPartialMolarVolumes(doublereal* vbar) const;
|
||||
virtual const vector_fp & getPartialMolarVolumes() const;
|
||||
|
||||
//@}
|
||||
/// @name Properties of the Standard State of the Species in the Solution
|
||||
|
|
|
|||
|
|
@ -825,6 +825,10 @@ public:
|
|||
|
||||
private:
|
||||
GibbsExcessVPSSTP *geThermo;
|
||||
// Temporary vectors that I don't want to allocate every time the function is called
|
||||
mutable vector_fp y;
|
||||
mutable vector_fp dlnActCoeff_NeutralMolecule;
|
||||
mutable vector_fp dX_NeutralMolecule;
|
||||
|
||||
//! If true then we own the underlying neutral Molecule Phase
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -413,6 +413,7 @@ public:
|
|||
* units = m^3 / kmol
|
||||
*/
|
||||
virtual void getStandardVolumes(doublereal* vol) const;
|
||||
virtual const vector_fp & getStandardVolumes() const;
|
||||
|
||||
//! Return a reference to a vector of the species standard molar volumes
|
||||
const vector_fp& standardVolumes() const {
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@ public:
|
|||
* units = m^3 / kmol
|
||||
*/
|
||||
virtual void getStandardVolumes(doublereal* vol) const;
|
||||
virtual const vector_fp & getStandardVolumes() const;
|
||||
|
||||
|
||||
//! Set the temperature of the phase
|
||||
|
|
|
|||
|
|
@ -1271,10 +1271,10 @@ private:
|
|||
vector_fp m_actCoeff;
|
||||
|
||||
//! RHS to the stefan-maxwell equation
|
||||
// DenseMatrix m_B;
|
||||
DenseMatrix m_B;
|
||||
|
||||
//! Matrix for the stefan maxwell equation.
|
||||
// DenseMatrix m_A;
|
||||
DenseMatrix m_A;
|
||||
|
||||
//! Current Temperature -> locally stored
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -184,9 +184,9 @@ void GibbsExcessVPSSTP::setPressure(doublereal p)
|
|||
|
||||
void GibbsExcessVPSSTP::calcDensity()
|
||||
{
|
||||
static vector_fp vbar(m_kk);
|
||||
vector_fp vbar = getPartialMolarVolumes();
|
||||
// double *vbar = &m_pp[0];
|
||||
getPartialMolarVolumes(&vbar[0]);
|
||||
// getPartialMolarVolumes(&vbar[0]);
|
||||
|
||||
doublereal vtotal = 0.0;
|
||||
for (size_t i = 0; i < m_kk; i++) {
|
||||
|
|
@ -294,6 +294,10 @@ void GibbsExcessVPSSTP::getPartialMolarVolumes(doublereal* vbar) const
|
|||
getStandardVolumes(vbar);
|
||||
}
|
||||
|
||||
const vector_fp & GibbsExcessVPSSTP::getPartialMolarVolumes() const
|
||||
{
|
||||
return getStandardVolumes();
|
||||
}
|
||||
|
||||
|
||||
doublereal GibbsExcessVPSSTP::err(const std::string& msg) const
|
||||
|
|
|
|||
|
|
@ -103,6 +103,10 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(const std::string& inputFile,
|
|||
}
|
||||
constructPhaseFile(inputFile, id);
|
||||
geThermo = dynamic_cast<GibbsExcessVPSSTP*>(neutralMoleculePhase_);
|
||||
y.resize(numNeutralMoleculeSpecies_,0.0);
|
||||
size_t numNeutMolSpec = geThermo->nSpecies();
|
||||
dlnActCoeff_NeutralMolecule.resize(numNeutMolSpec);
|
||||
dX_NeutralMolecule.resize(numNeutMolSpec);
|
||||
}
|
||||
//====================================================================================================================
|
||||
IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(XML_Node& phaseRoot,
|
||||
|
|
@ -127,6 +131,10 @@ IonsFromNeutralVPSSTP::IonsFromNeutralVPSSTP(XML_Node& phaseRoot,
|
|||
}
|
||||
constructPhaseXML(phaseRoot, id);
|
||||
geThermo = dynamic_cast<GibbsExcessVPSSTP*>(neutralMoleculePhase_);
|
||||
y.resize(numNeutralMoleculeSpecies_,0.0);
|
||||
size_t numNeutMolSpec = geThermo->nSpecies();
|
||||
dlnActCoeff_NeutralMolecule.resize(numNeutMolSpec);
|
||||
dX_NeutralMolecule.resize(numNeutMolSpec);
|
||||
}
|
||||
|
||||
//====================================================================================================================
|
||||
|
|
@ -216,6 +224,9 @@ operator=(const IonsFromNeutralVPSSTP& b)
|
|||
dlnActCoeffdlnX_diag_NeutralMolecule_ = b.dlnActCoeffdlnX_diag_NeutralMolecule_;
|
||||
dlnActCoeffdlnN_diag_NeutralMolecule_ = b.dlnActCoeffdlnN_diag_NeutralMolecule_;
|
||||
dlnActCoeffdlnN_NeutralMolecule_ = b.dlnActCoeffdlnN_NeutralMolecule_;
|
||||
y = b.y;
|
||||
dlnActCoeff_NeutralMolecule = b.dlnActCoeff_NeutralMolecule ;
|
||||
dX_NeutralMolecule = b.dX_NeutralMolecule ;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -960,8 +971,6 @@ void IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions() const
|
|||
void IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads(const doublereal* const dx, doublereal* const dy) const
|
||||
{
|
||||
doublereal fmij;
|
||||
static vector_fp y;
|
||||
y.resize(numNeutralMoleculeSpecies_,0.0);
|
||||
doublereal sumy, sumdy;
|
||||
|
||||
//check sum dx = 0
|
||||
|
|
@ -1491,8 +1500,8 @@ void IonsFromNeutralVPSSTP::getdlnActCoeffds(const doublereal dTds, const double
|
|||
}
|
||||
|
||||
size_t numNeutMolSpec = geThermo->nSpecies();
|
||||
static vector_fp dlnActCoeff_NeutralMolecule(numNeutMolSpec);
|
||||
static vector_fp dX_NeutralMolecule(numNeutMolSpec);
|
||||
// static vector_fp dlnActCoeff_NeutralMolecule(numNeutMolSpec);
|
||||
// static vector_fp dX_NeutralMolecule(numNeutMolSpec);
|
||||
|
||||
|
||||
getNeutralMoleculeMoleGrads(DATA_PTR(dXds),DATA_PTR(dX_NeutralMolecule));
|
||||
|
|
|
|||
|
|
@ -228,6 +228,15 @@ VPSSMgr::getStandardVolumes(doublereal* vol) const
|
|||
err("getStandardVolumes");
|
||||
}
|
||||
}
|
||||
const vector_fp &
|
||||
VPSSMgr::getStandardVolumes() const
|
||||
{
|
||||
if (m_useTmpStandardStateStorage) {
|
||||
return m_Vss;
|
||||
} else {
|
||||
err("getStandardVolumes");
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************/
|
||||
void
|
||||
|
|
|
|||
|
|
@ -272,6 +272,11 @@ void VPStandardStateTP::getStandardVolumes(doublereal* vol) const
|
|||
updateStandardStateThermo();
|
||||
m_VPSS_ptr->getStandardVolumes(vol);
|
||||
}
|
||||
const vector_fp & VPStandardStateTP::getStandardVolumes() const
|
||||
{
|
||||
updateStandardStateThermo();
|
||||
return m_VPSS_ptr->getStandardVolumes();
|
||||
}
|
||||
|
||||
/*
|
||||
* ----- Thermodynamic Values for the Species Reference States ----
|
||||
|
|
|
|||
|
|
@ -163,8 +163,8 @@ LiquidTransport& LiquidTransport::operator=(const LiquidTransport& right)
|
|||
m_actCoeff = right.m_actCoeff;
|
||||
m_Grad_lnAC = right.m_Grad_lnAC;
|
||||
m_chargeSpecies = right.m_chargeSpecies;
|
||||
// m_B = right.m_B;
|
||||
// m_A = right.m_A;
|
||||
m_B = right.m_B;
|
||||
m_A = right.m_A;
|
||||
m_temp = right.m_temp;
|
||||
m_press = right.m_press;
|
||||
m_flux = right.m_flux;
|
||||
|
|
@ -1584,8 +1584,6 @@ void LiquidTransport::update_Grad_lnAC()
|
|||
void LiquidTransport::stefan_maxwell_solve()
|
||||
{
|
||||
doublereal tmp;
|
||||
static DenseMatrix m_A(m_nsp, m_nsp, 0.0);
|
||||
static DenseMatrix m_B(m_nsp, m_nDim, 0.0);
|
||||
m_B.resize(m_nsp, m_nDim, 0.0);
|
||||
m_A.resize(m_nsp, m_nsp, 0.0);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue