-
Notifications
You must be signed in to change notification settings - Fork 1k
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 auto_advance parameter to PicardSolve #15614
Conversation
dc81ecc
to
d325696
Compare
Job Documentation on db89cd3 wanted to post the following: View the site here This comment will be updated on new commits. |
Job App tests on d325696 : invalidated by @lindsayad |
Job Documentation on d325696 : invalidated by @lindsayad |
I have to say this |
|
Nah, I have not reviewed this. I may like it after looking into the code or come up other suggestions. Just auto-auto word seems complicated to me. |
|
I do not see auto auto anywhere |
Lol I see it was in the PR title. Changed the PR title. There is no |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. A few minor comments
@@ -0,0 +1,9 @@ | |||
# TimePostprocessor | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we explain this object using one sentence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the redundancy that that brings. See this postprocessor's doc page, vs. the one for TimestepSize
which has an explicit description in the .md
file. If I didn't have the !syntax description /Postprocessors/TimePostprocessor
I would absolutely agree with you.
* Whether sub-applications are automatically advanced no matter what happens during their solves | ||
*/ | ||
bool autoAdvance() const; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds we should use forceAutoAdvance
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forceAutoAdvance
sounds like it would be a setter-type method to me. This is just querying the sate of whether we are auto-advancing
@@ -99,6 +99,9 @@ PicardSolve::validParams() | |||
params.addParam<bool>("update_xfem_at_timestep_begin", | |||
false, | |||
"Should XFEM update the mesh at the beginning of the timestep"); | |||
params.addParam<bool>("auto_advance", | |||
"Whether to automatically advance sub-applications regardless of whether " | |||
"their solve converges."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be a good idea to document what use case requires us to advance the state even though sub-apps fail to solve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what those use cases are. As you know I hate multiapps 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you, @YaqiWang, or @vincentlaboure know of some? I agree that I should add documentation about those cases. Otherwise yea even I don't understand why it's there!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of an example where auto_advance=true
would be desired but it doesn't mean there isn't one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does sound counter logic. If the solve in suapp is not successful, why not stop but rather advance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not name the parameter as force_advance
and default it to false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current logic auto advances sub-applications as long as you are not doing Picard. If I do what you are describing, then I will be changing the default behavior. Presumably we have tests and/or applications that rely on this default behavior. I don't know how this dumpster fire advanced to the point where we are at now, but I am terrified of modifying default behavior, as I assume the original code-writer had some reason for it being that way. This seems like a classic Chesterton's fence.
I am shocked any time I make changes in the PicardSolve/Transient/TransientMultiApp code system, and I don't break something. I suppose I could try changing the default and seeing whether any tests fail... How much should we bet that tests fail? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could have more shock before I created PicardSolve ;-) This is exactly we want to have tests. Breaking tests will force us to think of the design.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test I added applies auto_advance = false
. All other test cases in the world test the other case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, the conclusion is that we still do not know why we have that option when subapps fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test works as expected, thank you @lindsayad!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know current Transient and TransientMultiApp are messy even after I factored out Picard stuff into PicardSolve object. This looks like a bandage to me. I think the key is to document that extra parameter carefully and having a test. Thus in the future when we refactoring Transient
and TransientMultiApp
, we know what we are dealing with.
@@ -99,6 +99,9 @@ PicardSolve::validParams() | |||
params.addParam<bool>("update_xfem_at_timestep_begin", | |||
false, | |||
"Should XFEM update the mesh at the beginning of the timestep"); | |||
params.addParam<bool>("auto_advance", | |||
"Whether to automatically advance sub-applications regardless of whether " | |||
"their solve converges."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does sound counter logic. If the solve in suapp is not successful, why not stop but rather advance?
*/ | ||
virtual void finishStep() {} | ||
virtual void finishStep(bool /*recurse_through_multiapp_levels*/ = false) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This guy is doing nothing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh it is the base, nvm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do this always recursively? Of cause I do not know the implications here ;-) just throwing wrenches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we should not. We also call this from incrementStepOrReject
where we do not want to recurse through. But when the master solve is totally finished, then we also call this method, and it is then that we need to recurse through, otherwise we do not finish the steps of multiapp levels farther down than the first level.
@@ -99,6 +99,9 @@ PicardSolve::validParams() | |||
params.addParam<bool>("update_xfem_at_timestep_begin", | |||
false, | |||
"Should XFEM update the mesh at the beginning of the timestep"); | |||
params.addParam<bool>("auto_advance", | |||
"Whether to automatically advance sub-applications regardless of whether " | |||
"their solve converges."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not name the parameter as force_advance
and default it to false
?
I guess I only need you to update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am OK with this PR, even though I really really want an example to demonstrate that we have to keep going when subapps fail and crash.
This allows for uniform time-step cutting across multi-app levels even when not performing Picard between two levels, e.g. to prevent a sub-application from auto-advancing despite the state of it's solve, a user can specify `auto_advance = false` to require the master to cut its timestep. Closes idaholab#15166
d325696
to
face32d
Compare
I just pushed up a commit to never auto-advance...let's see what the results are |
I hate these systems with a fiery passion |
Which systems? |
Ok I think my conclusion is this: within the current design we need to have This conundrum could probably be fixed by having How does that sound to people? |
1aa091b
to
e9ee2d3
Compare
@fdkong hopefully I answered this in the above comment. The purpose of auto-advance is not to keep going even when subapps fail; the purpose is to keep the states of sub-applications in sync with the states of master applications whenever we can. |
bool | ||
PicardSolve::autoAdvance() const | ||
{ | ||
bool auto_advance = !(_has_picard_its && _problem.isTransient()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add your findings right here? So we know why we have auto on when there is no picard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I'll add some good documentation to the .md
files of what I've outlined in my comments here on github.
Note that I have this PR on draft, so I'm guessing the auto merge label isn't going to have an effect... Actually this could be an interesting test of CIVET 😄
With this PR, there are now multiple ways to approach the possibility of a failed sub-app solve.
@vincentlaboure I assume that you're aware of the |
Ok, documentation added to |
I actually have never used |
This is ready for review/merge |
Great, I would like to use |
This allows for uniform time-step cutting across multi-app levels even
when not performing Picard between two levels, e.g. to prevent a
sub-application from auto-advancing despite the state of it's solve, a
user can specify
auto_advance = false
to require the master to cut itstimestep.
Closes #15166