[Thermo] Avoid NaN in entropy with small negative mass fractions

Avoid NaN results in entropy_mole calculations when there are small negative
mass fractions. Consistent with the approach used elsewhere,
e.g. IdealGasPhase::getPartialMolarEntropies.
This commit is contained in:
Ray Speth 2019-08-09 13:30:47 -04:00
parent c4aff04418
commit b44f189569

View file

@ -657,7 +657,7 @@ doublereal Phase::sum_xlogx() const
{
double sumxlogx = 0;
for (size_t k = 0; k < m_kk; k++) {
sumxlogx += m_ym[k] * std::log(m_ym[k] + Tiny);
sumxlogx += m_ym[k] * std::log(std::max(m_ym[k], SmallNumber));
}
return m_mmw * sumxlogx + std::log(m_mmw);
}