Open stephankramer opened 3 months ago
The work of @fragkouan should be useful here - sometimes a few iteration have to take place between coupling https://github.com/fragkouan/thetis_wci/blob/138b2204c8fa3aea4ddda383168d17b0384146ee/thetis/solver2d.py#L1063
This issue has come up coupling Thetis to a goal-based mesh-adaptivity framework goalie but would equally be important coupling Thetis to other models via a coupling framework: Thetis only provides per timestep control via callbacks, which keeps Thetis in charge of runtime, and does not cater for an external framework to request a single timestep to be performed.
Two potential implementations that I can think of:
Use a generator approach. So change the current code
to either 1:
or 2:
where in both cases the user can use
solver_obj.iterate()
in exactly the same way as before.To get per time-step control, in case 1, the user (coupling framework) would have to do three things
whereas in case 2, that would simply be:
or if there's some further logic, or other looping requirements:
So at the moment I'm inclined to go for option 2.