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

Add more global time step control #1159

Merged
merged 6 commits into from
Aug 23, 2024
Merged

Add more global time step control #1159

merged 6 commits into from
Aug 23, 2024

Conversation

adamdempsey90
Copy link
Collaborator

@adamdempsey90 adamdempsey90 commented Aug 23, 2024

PR Summary

This was originally in a downstream PR, but some functionality was not available, so I've moved it upstream.

This adds some extra timestep controllers that are not package / meshblock / processor dependent.

  • dt_min: if dt <= dt_min for dt_min_count_max cycles, then PARTHENON_FAIL. Defaults to 10 bad cycles in a row.
  • dt_max: if dt >= dt_max, for dt_max_count_max cycles, then PARTHENON_FAIL. Defaults to 1 bad cycle in a row.
  • dt_user: user settable timestep suggestion (dt = min(dt, dt_user))
  • dt_force: Force the timestep to dt_force regardless of other controllers
  • dt_init: Set the first timestep to this value but allow it to be smaller if it wants to be. To force this value, the user can set dt_init_force = true.
  • dt_floor: sets dt = std::max(dt , dt_floor)
  • dt_ceil : sets dt = std::min(dt, dt_ceil)
  • dt_factor: dt / dt_previous <= dt_factor. Previously, this was hard coded to 2.

The main purpose of dt_min and dt_max is to stop simulations from going off the rails and cycling on 1e-20 timesteps or blowing up.

All of these options are "off" by default.

I have tested all options in a downstream code.

PR Checklist

  • Code passes cpplint
  • New features are documented.
  • Adds a test for any bugs fixed. Adds tests for new features.
  • Code is formatted
  • Changes are summarized in CHANGELOG.md
  • Change is breaking (API, behavior, ...)
    • Change is additionally added to CHANGELOG.md in the breaking section
    • PR is marked as breaking
    • Short summary API changes at the top of the PR (plus optionally with an automated update/fix script)
  • CI has been triggered on Darwin for performance regression tests.
  • Docs build
  • (@lanl.gov employees) Update copyright on changed files

Copy link
Collaborator

@lroberts36 lroberts36 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, definitely will be useful for me in a couple of places downstream. Just a few questions below that are non-blocking.

src/driver/driver.cpp Show resolved Hide resolved
src/driver/driver.cpp Show resolved Hide resolved
src/driver/driver.cpp Outdated Show resolved Hide resolved
src/driver/driver.cpp Show resolved Hide resolved
src/driver/driver.cpp Outdated Show resolved Hide resolved
src/driver/driver.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@brryan brryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@Yurlungur Yurlungur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great improvement! Have definitely felt the lack of these features more than once before. Can we make sure to add to the changelog? Also would be good to have these in the docs for reference.

@adamdempsey90
Copy link
Collaborator Author

This is a great improvement! Have definitely felt the lack of these features more than once before. Can we make sure to add to the changelog? Also would be good to have these in the docs for reference.

Done. I took the opportunity to also alphabetize the parameters.

@Yurlungur
Copy link
Collaborator

This is a great improvement! Have definitely felt the lack of these features more than once before. Can we make sure to add to the changelog? Also would be good to have these in the docs for reference.

Done. I took the opportunity to also alphabetize the parameters.

Nice!

@Yurlungur Yurlungur merged commit 3a969ff into develop Aug 23, 2024
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants