[Kinetics] Fix handling of undeclared third bodies in Falloff reactions

This commit is contained in:
Ray Speth 2015-05-05 23:09:38 -04:00
parent 08f0fb5bf6
commit 092937fd06
2 changed files with 10 additions and 1 deletions

View file

@ -6,6 +6,7 @@
#define CT_THIRDBODYCALC_H
#include "cantera/base/utilities.h"
#include <cassert>
namespace Cantera
{
@ -26,6 +27,7 @@ public:
iter != enhanced.end();
++iter)
{
assert(iter->first != npos);
m_species.back().push_back(iter->first);
m_eff.back().push_back(iter->second - dflt);
}

View file

@ -359,7 +359,14 @@ void GasKinetics::addFalloffReaction(FalloffReaction& r)
for (Composition::const_iterator iter = r.third_body.efficiencies.begin();
iter != r.third_body.efficiencies.end();
++iter) {
efficiencies[kineticsSpeciesIndex(iter->first)] = iter->second;
size_t k = kineticsSpeciesIndex(iter->first);
if (k != npos) {
efficiencies[k] = iter->second;
} else if (!m_skipUndeclaredThirdBodies) {
throw CanteraError("GasKinetics::addTFalloffReaction", "Found "
"third-body efficiency for undefined species '" + iter->first +
"' while adding reaction '" + r.equation() + "'");
}
}
m_falloff_concm.install(m_nfall, efficiencies,
r.third_body.default_efficiency);