Skip to content

Commit 73db64a

Browse files
committed
[Kinetics] Fix cache invalidation corner cases
1 parent 5647d38 commit 73db64a

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

src/kinetics/GasKinetics.cpp

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,15 @@ void GasKinetics::update_rates_T()
5252
m_ROP_ok = false;
5353
}
5454

55-
if (T != m_temp || P != m_pres) {
56-
57-
// loop over MultiBulkRates evaluators
58-
// @todo ... address/reassess logic as this update can fail
59-
// (see tests/kinetics/KineticsFromScratch.cpp:
60-
// KineticsAddSpecies - add_species_sequential)
61-
// a work-around is to call GasKinetics::invalidateCache()
62-
for (auto& rates : m_bulk_rates) {
63-
bool changed = rates->update(thermo(), *this);
64-
if (changed) {
65-
rates->getRateConstants(m_rfn.data());
66-
}
55+
// loop over MultiBulkRate evaluators for each reaction type
56+
for (auto& rates : m_bulk_rates) {
57+
bool changed = rates->update(thermo(), *this);
58+
if (changed) {
59+
rates->getRateConstants(m_rfn.data());
60+
m_ROP_ok = false;
6761
}
68-
62+
}
63+
if (T != m_temp || P != m_pres) {
6964
// P-log reactions (legacy)
7065
if (m_plog_rates.nReactions()) {
7166
m_plog_rates.update(T, logT, m_rfn.data());

test/kinetics/kineticsFromScratch.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,6 @@ class KineticsAddSpecies : public testing::Test
427427
p.setState_TPX(1200, 5*OneAtm, X);
428428
p_ref.setState_TPX(1200, 5*OneAtm, X);
429429

430-
// need to invalidate cache to force update
431-
kin_ref->invalidateCache();
432-
433430
vector_fp k(kin.nReactions()), k_ref(kin_ref->nReactions());
434431
vector_fp w(kin.nTotalSpecies()), w_ref(kin_ref->nTotalSpecies());
435432

0 commit comments

Comments
 (0)