Skip to content

Commit

Permalink
[Thermo] Fix calculation of IdealMolalSoln::intEnergy_mole
Browse files Browse the repository at this point in the history
  • Loading branch information
speth authored and ischoegl committed Jun 10, 2022
1 parent 2472923 commit e06ad6b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
13 changes: 13 additions & 0 deletions include/cantera/thermo/IdealMolalSoln.h
Expand Up @@ -295,6 +295,19 @@ class IdealMolalSoln : public MolalityVPSSTP
*/
virtual void getPartialMolarEnthalpies(doublereal* hbar) const;

//! Returns an array of partial molar internal energies for the species in the
//! mixture.
/*!
* Units (J/kmol). For this phase, the partial molar internal energies are equal to
* the species standard state internal energies (which are equal to the reference
* state internal energies)
* \f[
* \bar u_k(T,P) = \hat u^{ref}_k(T)
* \f]
* @param hbar Output vector of partial molar internal energies, length #m_kk
*/
virtual void getPartialMolarIntEnergies(doublereal* hbar) const;

//! Returns an array of partial molar entropies of the species in the
//! solution. Units: J/kmol.
/*!
Expand Down
10 changes: 9 additions & 1 deletion src/thermo/IdealMolalSoln.cpp
Expand Up @@ -65,7 +65,7 @@ doublereal IdealMolalSoln::enthalpy_mole() const

doublereal IdealMolalSoln::intEnergy_mole() const
{
getPartialMolarEnthalpies(m_tmpV.data());
getPartialMolarIntEnergies(m_tmpV.data());
return mean_X(m_tmpV);
}

Expand Down Expand Up @@ -248,6 +248,14 @@ void IdealMolalSoln::getPartialMolarEnthalpies(doublereal* hbar) const
}
}

void IdealMolalSoln::getPartialMolarIntEnergies(double* ubar) const
{
getIntEnergy_RT(ubar);
for (size_t k = 0; k < m_kk; k++) {
ubar[k] *= RT();
}
}

void IdealMolalSoln::getPartialMolarEntropies(doublereal* sbar) const
{
getEntropy_R(sbar);
Expand Down
2 changes: 1 addition & 1 deletion test_problems/cathermo/ims/output_blessed.txt
@@ -1,5 +1,5 @@
molar enthalpy = 0.013282 J kg-1
molar intEnergy = 0.013282 J kg-1
molar intEnergy = -1.5185e+05 J kg-1
molar entropy = 93.635 J kg-1 K-1
molar gibbs = -3.8986e+07 J kg-1
molar Cp = 28836 J kg-1 K-1
Expand Down

0 comments on commit e06ad6b

Please sign in to comment.