fix(LogicalReaclibReaction): fixed bug where reaclib reverse reactions were being included in forward reaction sets erroneously
Previously, due to a indexing issue, reverse rates were sometimes included in the forward rates for strong reactions. This lead to erroneously high molar reaction flows for some reactions. This has been resolved so now each logical reaction set is guareteed to include only either forward reactions or reverse reactions (not both)
This commit is contained in:
@@ -225,9 +225,21 @@ namespace gridfire {
|
||||
const bool activeSpeciesIsSubset = std::ranges::any_of(activeSpecies, [&](const auto& species) -> bool {
|
||||
return !involvesSpecies(species);
|
||||
});
|
||||
if (activeSpeciesIsSubset) {
|
||||
LOG_CRITICAL(m_logger, "Active species contains species not in the network partition. Cannot generate Jacobian matrix for active species.");
|
||||
throw std::runtime_error("Active species contains species not in the network partition. Cannot generate Jacobian matrix for active species.");
|
||||
if (!activeSpeciesIsSubset) {
|
||||
std::string msg = std::format(
|
||||
"Active species set contains species ({}) not present in network partition. Cannot generate jacobian matrix due to this.",
|
||||
[&]() -> std::string {
|
||||
std::stringstream ss;
|
||||
for (const auto& species : activeSpecies) {
|
||||
if (!this->involvesSpecies(species)) {
|
||||
ss << species << " ";
|
||||
}
|
||||
}
|
||||
return ss.str();
|
||||
}()
|
||||
);
|
||||
LOG_CRITICAL(m_logger, "{}", msg);
|
||||
throw std::runtime_error(msg);
|
||||
}
|
||||
|
||||
std::vector<Species> dynamicActiveSpeciesIntersection;
|
||||
|
||||
Reference in New Issue
Block a user