[petsc-users] Initial Guess for KSP in SNES

Derek Gaston friedmud at gmail.com
Sun Apr 29 13:26:09 CDT 2018


Nice!  Thanks Stefano - I'll check those out.  I actually don't solve
linear problems very often so I don't know about all the technology
available :-)

Derek

On Sun, Apr 29, 2018 at 12:18 PM Stefano Zampini <stefano.zampini at gmail.com>
wrote:

> For linear time dependent problems you can try KSPGUESSFISCHER and
> KSPGUESSPOD, that project the linear system on a lower dimensional
> manifold. Note that there are also integrators, like bdf, that already
> computed a fairly good initial guess for Newton.
>
> Il Dom 29 Apr 2018, 21:14 Derek Gaston <friedmud at gmail.com> ha scritto:
>
>> I suppose that's a good point.
>>
>> This came about because I happen to be solving linear problems right now
>> - and I'm just using KSP - but I'm still solving for an "update" as in a
>> Newton method.  So, naturally, I wanted to "predict" the update of that
>> linear problem each timestep.  That got me thinking about what we generally
>> choose as the initial guess for the KSP in SNES so I went looking.
>>
>> I think the moral of the story here is, as per usual, making good guesses
>> for the solution of the nonlinear solve is a good idea. It obviously helps
>> Newton and it makes the initial guess of 0 for the solution of the update
>> also make more sense.
>>
>> Also: I hadn't really considered the effect of an initial guess on a
>> Krylov solver before.  It's intuitively obvious that providing a good
>> initial guess helps Newton (for instance, guessing within the ball of
>> convergence)... but I haven't seen much work on how the initial guess
>> effects Krylov solvers before.  A bit of googling led me to this paper
>> which is interesting:
>> http://dodo.inm.ras.ru/vassilevski/wp-content/uploads/2015/01/jcp219_210-227.pdf do
>> you know of another reference that is related?
>>
>> Thanks for the response,
>> Derek
>>
>> On Sun, Apr 29, 2018 at 11:54 AM Jed Brown <jed at jedbrown.org> wrote:
>>
>>> Why do you want it to be an initial guess for the linear problem rather
>>> than for the nonlinear problem?
>>>
>>> I think you can use SNESSetUpdate() and in that function,
>>> SNESGetSolutionUpdate() which you can set to whatever you want the
>>> initial guess to be.
>>>
>>> Derek Gaston <friedmud at gmail.com> writes:
>>>
>>> > I'm interested in setting the initial guess for the first KSP solve in
>>> SNES
>>> > (used in a transient calculation) - and whether anyone thinks it could
>>> be a
>>> > good thing to do.
>>> >
>>> > I see some previous discussion on this from Jed and Matt here:
>>> >
>>> https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2014-September/022779.html
>>> >
>>> https://lists.mcs.anl.gov/mailman/htdig/petsc-users/2014-September/022780.html
>>> >
>>> > I realize that the Newton solver is solving for the update... but that
>>> > doesn't necessarily mean that guessing 0 is the best plan.  For
>>> instance:
>>> > for fairly linear problems in time (or slightly nonlinear depending on
>>> how
>>> > you look at it!) it might be a good idea to guess the first update to
>>> be
>>> > the difference between the previous two time steps (or: more generally
>>> some
>>> > sort of "projected" update based on your time integration scheme).
>>> >
>>> > Indeed - for a perfectly linear problem in time (with constant dt) this
>>> > would yield a "perfect" guess for the linear solver and it would return
>>> > immediately.
>>> >
>>> > I suppose that if you use a "predictor" for predicting the guess for
>>> the
>>> > nonlinear system (which we often do - but not always)... then 0 for
>>> your
>>> > first update is probably a decent choice (what else would you choose?).
>>> > But if you're simply using the old timestep solution (which is what is
>>> > commonly done)... then that first update is more likely to look like
>>> the
>>> > difference between the last two timesteps than it looks like 0.
>>> >
>>> > Thoughts?
>>> >
>>> > Derek
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180429/a3a2755d/attachment-0001.html>


More information about the petsc-users mailing list