firedrakeproject / asQ

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

Use AllAtOnceSystem state as initial guess for PETSc solve at each window #114

Closed JHopeCollins closed 1 year ago

JHopeCollins commented 1 year ago

This PR fixes a bug for moving from one window to the next.

After each window solve, we copy the solution into the all-at-once function of the AllAtOnceSystem, which is correct. However, before each window solve, we don't copy the all-at-once-function into the PETSc Vec used for the solve.

This is incorrect because the value of this Vec at the beginning of the solve is used as the initial guess. This means that so far we have actually been using the solution of the previous window as the initial guess to the next window, instead of using window initial condition.

There are also two other small changes:

  1. AllAtOnceSystem now makes a copy of the initial conditions, rather than just keeping a handle to the function that the user provides.
  2. Slight change in how we check the ConvergedReason of the all-at-once solve so that we can use 'snes_type': 'ksponly' for linear systems.