Skip to content

TBD: Follow time stepping proposed in documentation#96

Merged
IshaanDesai merged 2 commits intodevelopfrom
fix-issue-with-time-stepping-participant-first
Apr 23, 2024
Merged

TBD: Follow time stepping proposed in documentation#96
IshaanDesai merged 2 commits intodevelopfrom
fix-issue-with-time-stepping-participant-first

Conversation

@BenjaminRodenberg
Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor 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
Copy Markdown
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
@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.

2 participants