[Equil] Fix invalid memory access in VCS solver

Before bba0d8edf, the vector m_molNumSpecies_new was of a size greater than
m_nsp, with elements m_nsp through the end always filled with zeros. Thus the
check removed here always passed. In bba0d8edf, the vector size was reduced to
be the correct size (m_nsp), so this resulted in this check accessing
unallocated memory, causing the check to fail randomly in the TestKOH_Equil
test. The resulting exception was always caught internally, so the solver wasn't
returning incorrect results, but the non-determinism was leading to unexpected
changes in code coverage reports.
This commit is contained in:
Ray Speth 2017-12-05 22:26:45 -05:00
parent 17dfa2dd48
commit 1eebd3efdb

View file

@ -430,10 +430,6 @@ void VCS_SOLVE::solve_tp_inner(size_t& iti, size_t& it1,
m_tPhaseMoles_new[iph] += m_deltaMolNumSpecies[k];
}
if (kspec >= m_numComponents) {
if (m_molNumSpecies_new[m_nsp] != 0.0) {
throw CanteraError("VCS_SOLVE::solve_tp_inner",
"we shouldn't be here!");
}
if (m_SSPhase[kspec] == 1) {
m_speciesStatus[kspec] = VCS_SPECIES_ZEROEDSS;
} else {