[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:
parent
c4aff04418
commit
b44f189569
1 changed files with 1 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue