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

TBD: Follow time stepping proposed in documentation #96

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

BenjaminRodenberg
Copy link
Member

In the step-by-step guide on precice.org it is suggested to get the maximum allowed time step size from preCICE before calling advance.

To me it looks dangerous how things are done at the moment, because actually the following is happening:

self._participant.advance(self._dt)
self._dt = self._participant.get_max_time_step_size()

t += self._dt
n += 1

We tell preCICE "I just finished window n with time step size self._dt, but then update the internal time t by the step size of the upcoming window. I always prefer to first do all the updates and then call advance:

self._dt = self._participant.get_max_time_step_size()    # assuming this has been called at the beginning of the current time step
...
# time step is finished, update internal counters
t += self._dt 
n += 1

self._participant.advance(self._dt)  # tell preCICE: I'm done and ready to go to the next time step / iteration

This should generally also work with subcycling and/or the participant-first method (no guarantee, because this needs testing and is always easy to break, if hard-to-spot errors are in the code)

In the step-by-step guide on precice.org it is suggested to get the maximum allowed time step size from preCICE before calling advance.
@BenjaminRodenberg BenjaminRodenberg added the bug Something isn't working label Apr 22, 2024
@BenjaminRodenberg BenjaminRodenberg self-assigned this Apr 22, 2024
@BenjaminRodenberg
Copy link
Member Author

The comments I put into the code are a bit excessive. Feel free to remove them. They are mainly intended for simplifying the review process.

Copy link
Member

@IshaanDesai IshaanDesai left a comment

Choose a reason for hiding this comment

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

Seems logical if one goes by the latest documentation on the preCICE website.

@IshaanDesai IshaanDesai merged commit 5d118d9 into develop Apr 23, 2024
10 checks passed
@IshaanDesai IshaanDesai deleted the fix-issue-with-time-stepping-participant-first branch April 23, 2024 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants