Skip to content

Commit

Permalink
[Reactor] Fix getting sensitivities after calls to advance
Browse files Browse the repository at this point in the history
Previously, values would be returned for the sensitivity at the
last internal timestep of the integrator, rather than being interpolated
to the user-specified integration time.
  • Loading branch information
speth committed Aug 4, 2023
1 parent 59625eb commit 652ed24
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/numerics/CVodesIntegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ double CVodesIntegrator::sensitivity(size_t k, size_t p)
return 0.0;
}
if (!m_sens_ok && m_np) {
int flag = CVodeGetSens(m_cvode_mem, &m_time, m_yS);
int flag = CVodeGetSensDky(m_cvode_mem, m_time, 0, m_yS);
checkError(flag, "sensitivity", "CVodeGetSens");
m_sens_ok = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/numerics/IdasIntegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ double IdasIntegrator::sensitivity(size_t k, size_t p)
return 0.0;
}
if (!m_sens_ok && m_np) {
int flag = IDAGetSens(m_ida_mem, &m_time, m_yS);
int flag = IDAGetSensDky(m_ida_mem, m_time, 0, m_yS);

Check warning on line 515 in src/numerics/IdasIntegrator.cpp

View check run for this annotation

Codecov / codecov/patch

src/numerics/IdasIntegrator.cpp#L515

Added line #L515 was not covered by tests
checkError(flag, "sensitivity", "IDAGetSens");
m_sens_ok = true;
}
Expand Down

0 comments on commit 652ed24

Please sign in to comment.