-
-
Notifications
You must be signed in to change notification settings - Fork 184
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 time accumulation and max time #1933
Conversation
a32aa17
to
001319c
Compare
001319c
to
a5c9c71
Compare
double leftover = _maxTime - _time; | ||
return std::min(maxDt, leftover); |
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 we really want to forward here an arbitrary small dt? I would say that the current behavior is numerically still more robust. Not sure that this PR is the right place to add it into the library.
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 previous state was flatout wrong.
time-window-size
= 0.3 and max-time
= 1 resulted in a timestep from 0.9 to 1.2.
Now the final time-window-size is correctly synchronized.
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.
With participant-first methods and adaptive time-stepping (e.g. in OpenFOAM) this can still lead to issues. In the adapter, we set the end time to infinity such that preCICE steers it. Hence, the solver is not aware of the maxTime limit and this return value can lead o arbitrary small dt causing numerical issues then.
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 just realized that this only applies to hasTimeWindowSize()
. What happens to the second participant in a participant-first
time-stepping. Do we then perform different time-step length for different participants?
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.
For participant-first
there are two cases:
first
doesn't have a time window size as it is dictating it. ThegetNextTimeStepMaxSize()
is maxTime if provided and inf otherwise.
This was correctly implemented.second
has a dynamic time window size which it received fromfirst
, which is correctly limited by max-time. So in theory this cannot surpass max-time.
Main changes of this PR
This PR
Motivation and additional information
time-window-size = 0.01 and max-time = 5 leads to 501 time windows due to rounding errors.
This should solve the problem.
Author's checklist
pre-commit
hook to prevent dirty commits and usedpre-commit run --all
to format old commits.make changelog
if there are user-observable changes since the last release.