firedrakeproject / asQ

A library for implementing ParaDIAG timestepping algorithms using Firedrake
MIT License
4 stars 1 forks source link

Add a windowing loop with callback to `paradiag.solve()` #55

Closed JHopeCollins closed 2 years ago

JHopeCollins commented 2 years ago

Also adding some utility functions such as:

JHopeCollins commented 2 years ago

As well as the windowing loop in paradiag.solve(), I also added a few QoL functions that I needed for the for_each_timestep() method. A summary of the changes:

  1. paradiag.solve() now takes the number of windows to solve, as well as two callbacks: one called just before the window solve (so w_all is the initial conditions), and one called just after (so w_all is the solution for the window)
  2. paradiag.for_each_timestep(): calls a callback with the solution at each timestep in turn. Useful for postprocessing.
  3. paradiag.set/get_timestep(): set and extract solution at individual timesteps from all-at-once function.
  4. paradiag.shift_index(): logic for shifting between window/slice indices and dealing with negative indices
  5. paradiag.check_index(): check a timestep index is within stated range.
  6. Using these methods to simplify some bits of the code.