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

Handle substeps in LTS error control #5943

Merged
merged 3 commits into from
May 5, 2024

Conversation

wthrowe
Copy link
Member

@wthrowe wthrowe commented Apr 25, 2024

Preparation for adding LTS substep methods.

Proposed changes

Upgrade instructions

Code review checklist

  • The code is documented and the documentation renders correctly. Run
    make doc to generate the documentation locally into BUILD_DIR/docs/html.
    Then open index.html.
  • The code follows the stylistic and code quality guidelines listed in the
    code review guide.
  • The PR lists upgrade instructions and is labeled bugfix or
    new feature if appropriate.

Further comments

Copy link
Member

@nilsdeppe nilsdeppe left a comment

Choose a reason for hiding this comment

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

LGTM, a couple minor suggestions you can squash immediately

#include "Time/Time.hpp"

template <typename T>
struct StepperErrorEstimate {
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add doxygen documentation to this?

size_t order{};
T error{};

void pup(PUP::er& p) {
Copy link
Member

Choose a reason for hiding this comment

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

Move out of line?

@wthrowe
Copy link
Member Author

wthrowe commented Apr 29, 2024

Done. Also changed the initializer for TimeDelta step_size{{}, 0}; to plain {} because that weirdness was left over from an earlier attempt.

// won't improve the reported error, so make sure to only do it
// if we actually request a smaller step.
return std::make_pair(new_step,
new_step >= previous_step or l_inf_error <= 1.0);
Copy link
Member Author

Choose a reason for hiding this comment

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

Wait, this is backwards.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, no, it's the right way, but it does need an abs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Pushed a fixup for this and updated the test so it would have been caught.

@wthrowe wthrowe added in progress Don't review, used for sharing code and getting feedback and removed in progress Don't review, used for sharing code and getting feedback labels Apr 30, 2024
@wthrowe
Copy link
Member Author

wthrowe commented Apr 30, 2024

And added a small commit fixing a preexisting bug in the test.

Copy link
Member

@nilsdeppe nilsdeppe left a comment

Choose a reason for hiding this comment

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

LGTM! Please go ahead and squash!

Aside from cleanup, the main effect of this change is that the
ErrorControl stepper now always uses the most recent error estimate,
where it used to only activate if that estimate was from the most
recent evaluation.  The only case where that matters is for LTS
updating with a multistage method, which used to not work and now uses
the error estimates from the previous two steps, as opposed to the
current and previous step for single-stage LTS.  This matches the
behavior for GTS adjustment, so should be acceptable for now.
It's not valid for any TimeStepper, so move logic to the calling code
instead of the steppers.
@nilsdeppe nilsdeppe merged commit a9ee6aa into sxs-collaboration:develop May 5, 2024
22 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.

2 participants