Skip to content

Commit

Permalink
Follow time stepping proposed in documentation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
BenjaminRodenberg authored Apr 22, 2024
1 parent 03a6d18 commit f12f60d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions micro_manager/micro_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ def solve(self) -> None:
)

while self._participant.is_coupling_ongoing():

self._dt = self._participant.get_max_time_step_size() # ask preCICE at beginning of time step for allowed time step size

# Write a checkpoint
if self._participant.requires_writing_checkpoint():
for i in range(self._local_number_of_sims):
Expand Down Expand Up @@ -256,11 +259,9 @@ def solve(self) -> None:

self._write_data_to_precice(micro_sims_output)

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

t += self._dt
n += 1
t += self._dt # increase internal time when time step is done.
n += 1 # increase counter
self._participant.advance(self._dt) # notify preCICE that time step of size self._dt is complete

# Revert micro simulations to their last checkpoints if required
if self._participant.requires_reading_checkpoint():
Expand Down

0 comments on commit f12f60d

Please sign in to comment.