feat(CVODE_Solver_Strategy): added non negative constraint to CVODE based abundance solver

this prevents abundance values from going negative which is non physical
This commit is contained in:
2025-09-22 11:15:14 -04:00
parent 813e62bdd6
commit 4c91f8c525
4 changed files with 40 additions and 1 deletions

View File

@@ -244,6 +244,9 @@ namespace gridfire {
// If j is algebraic, we can return 0.0 since the Jacobian entry for algebraic species is always zero.
return 0.0;
}
if (std::ranges::contains(m_algebraic_species_indices, i_full)) {
return 0.0;
}
// Otherwise we need to query the full jacobian
return m_baseEngine.getJacobianMatrixEntry(i_full, j_full);
}