Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix off-by-one error in iteration counter #2549

Merged
merged 1 commit into from
Jun 13, 2022
Merged

Conversation

johnomotani
Copy link
Contributor

Bug introduced in #2534. After #2534, calling the monitors always increments the Solver::iteration counter. When monitors are called before the first internal timestep (if dump_on_restart=true), we do not actually want to increment the counter - this call is either at the very beginning of a simulation, when the counter should remain 0 until the end of the first output step, or it is effectively a repeat of the last call to monitors in the simulation that is being restarted from so that incrementing the counter would be double-counting.

Simplest fix seems to be to decrement the counter if the monitors are called at the beginning of a run. Was not an issue before #2534 because the counter was incremented by each solver implementation rather than by the monitors, so the initial call to monitors did not touch the counter.

@ZedThree ZedThree merged commit f353d4e into master Jun 13, 2022
@ZedThree ZedThree deleted the fix-iteration-counter branch June 13, 2022 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants