Fix indexing error in ImplicitSurfChem::eval

This method was not working in the case where there was more than one surface
phase, since 'loc' was always set to zero.
This commit is contained in:
Ray Speth 2015-11-24 13:31:45 -05:00
parent a75a8f2c82
commit 2dfa43ffa7

View file

@ -150,13 +150,12 @@ void ImplicitSurfChem::eval(doublereal time, doublereal* y,
{
updateState(y); // synchronize the surface state(s) with y
doublereal rs0, sum;
size_t loc, kstart;
size_t loc = 0, kstart;
for (size_t n = 0; n < m_nsurf; n++) {
rs0 = 1.0/m_surf[n]->siteDensity();
m_vecKinPtrs[n]->getNetProductionRates(m_work.data());
kstart = m_vecKinPtrs[n]->kineticsSpeciesIndex(0,m_surfindex[n]);
sum = 0.0;
loc = 0;
for (size_t k = 1; k < m_nsp[n]; k++) {
ydot[k + loc] = m_work[kstart + k] * rs0 * m_surf[n]->size(k);
sum -= ydot[k];