Skip to content

Conversation

@moxcodes
Copy link
Contributor

@moxcodes moxcodes commented Feb 6, 2021

Proposed changes

Various small changes to time steppers, step choosers, and step controllers that preserve existing functionality, but allow the possibility of an iterative process to support step rejection and retry.

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
    major new feature if appropriate.

@moxcodes moxcodes requested a review from wthrowe February 6, 2021 01:30
@moxcodes moxcodes force-pushed the error_stepping_infra_tweaks branch from c47767a to 6dd8c58 Compare February 6, 2021 03:48
@moxcodes
Copy link
Contributor Author

moxcodes commented Feb 6, 2021

Removed a small part that better fits in a different PR.

@moxcodes moxcodes force-pushed the error_stepping_infra_tweaks branch 3 times, most recently from dc11cc0 to 1ff9fbd Compare February 8, 2021 18:47
@moxcodes
Copy link
Contributor Author

moxcodes commented Feb 8, 2021

I've dropped the step controller change, and added a fixup for the step chooser documentation.
For the moment, I've prefixed the Separate timestepper history clean-up with drop, as @wthrowe plans to submit a separate PR to perform a similar task in a way that will work better for dense output features; Once that is in, I'll rebase this PR and drop the commit associated with history clean-up from this one.

Copy link
Member

@wthrowe wthrowe left a comment

Choose a reason for hiding this comment

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

I'm having trouble quickly getting the history management working in a way compatible with both this and dense output, so let's go with this form so we're not blocking you and I'll change it for dense output later.

Comment on lines 429 to 430
ASSERT(history.size() <= order_,
ASSERT(history.size() <= order_ + 1,
"Length of history (" << history.size() << ") "
<< "should not exceed target order (" << order_ << ")");
<< "should not exceed target order (" << order_ << ") by more than 1");
Copy link
Member

Choose a reason for hiding this comment

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

What is this change about?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, yeah good catch -- these couple of lines of the hunk should be dropped. It was for an earlier and less elegant attempt at the history cleanup change.

for (uint64_t i = 0; i < num_steps; ++i) {
take_step(&time, &y, &history, stepper, rhs, step_size);
// last parameter: check that we can apply the stepper sometime in the
// middle of the evolution without messing anything up.
Copy link
Member

Choose a reason for hiding this comment

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

"apply the stepper twice", maybe? Again later.

@moxcodes moxcodes force-pushed the error_stepping_infra_tweaks branch from 1ff9fbd to efe1fd8 Compare February 9, 2021 23:17
@moxcodes
Copy link
Contributor Author

moxcodes commented Feb 9, 2021

Dropped the part of the hunk that shouldn't have been present, added a fixup for the comment change, and removed the drop: prefix from the commit about the history cleanup.

@wthrowe
Copy link
Member

wthrowe commented Feb 10, 2021

Looks good. Squash.

@moxcodes moxcodes force-pushed the error_stepping_infra_tweaks branch from efe1fd8 to b676e69 Compare February 10, 2021 01:03
@moxcodes
Copy link
Contributor Author

Squashed.
Cheers!

wthrowe
wthrowe previously approved these changes Feb 10, 2021
Copy link
Member

@nilsvu nilsvu left a comment

Choose a reason for hiding this comment

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

LGTM, though I'm by no means an expert in time-stepping :)

/// a strictly smaller step, guided by the requested time step value.
template <typename Metavariables, typename DbTags>
double desired_step(
std::pair<double, bool> desired_step(
Copy link
Member

Choose a reason for hiding this comment

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

Would it be reasonable to make the return value here a std::optional<double>, meaning either "do a step with this size" or "don't do a step"? So the question is: Will the "desired step" double be used also when the "acceptance" bool is false? If this is what you mean with "guided by the requested time step value", please clarify, e.g. by rewording to "... the desired step value returned by this function".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The return value is used when the step is rejected to choose the step size when retrying the step; it is assumed that when the step is rejected the returned step size is strictly smaller than the previously tried step. I'll clarify the documentation.

@moxcodes
Copy link
Contributor Author

Squashed in documentation rewording.
Cheers!

nilsvu
nilsvu previously approved these changes Feb 13, 2021
@nilsvu
Copy link
Member

nilsvu commented Feb 15, 2021

@wthrowe could you take another look at this?

@wthrowe
Copy link
Member

wthrowe commented Feb 15, 2021

@moxcodes What do you want to do with respect to #2883? Do you want to drop your history changes here or have me revert them when I'm ready to merge that?

@wthrowe
Copy link
Member

wthrowe commented Feb 15, 2021

Also, @nilsleiffischer, please give me some time to respond to things before pinging me. I find it annoying.

@moxcodes
Copy link
Contributor Author

@wthrowe Would it be too much hassle for you to split out the commit that does the history clean-up at the start of the step to a different PR? Then that could be a dependency of both this (with my history clean up change dropped) and your larger PR that makes the self-start changes
The part here that checks that the step can be re-applied depends on the history clean up changes... If I understand the changes in #2883 correctly, there's no change to the cleanup for substep methods, which means that those methods won't be able to be re-applied (because on the conclusion of the full step, the history will be cleaned up and unavailable for retries). I think that's fine with me for now, I can just remove the expectation of substep re-application from this PR as well -- were any of the features that you needed dependent on being able to repeat update_u in substep methods?

@wthrowe
Copy link
Member

wthrowe commented Feb 16, 2021

I don't need the update_u changes. I think I just took them to avoid some git conflict. I do use "Add order function to TimeSteppers", but that's simple so I can just cherry-pick it.

You are correct that I haven't done the substep methods, but redoing a substep probably isn't useful anyway. (And redoing a full step is a different challenge.) Substep methods will need to be converted eventually for dense output.

Submitted as #2894.

- necessary to support the error measure update as a `Variables` with a
different tag prefix
This is needed for step-unwinding. This adjusts the interface by consistently
using the latest volume data in the history instead of using the current `u`
value in some steppers
@moxcodes
Copy link
Contributor Author

rebased following merge of #2894, and dropped the history cleanup parts.
Cheers!

@nilsdeppe nilsdeppe merged commit 9ccc388 into sxs-collaboration:develop Feb 19, 2021
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