<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi, Jed,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I agree with you that it's not wise to reuse pc with new operator.</div><div class="gmail_default" style="font-size:small">Basically, I just keep pc and matrix updating concurrently.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for telling me that option in ksp. </div><div class="gmail_default" style="font-size:small">It works.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Bests,</div><div class="gmail_default" style="font-size:small">Jinlei</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 19, 2016 at 12:27 AM, Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Jinlei Shen <<a href="mailto:jshen25@jhu.edu">jshen25@jhu.edu</a>> writes:<br>
<br>
> Hi Matt,<br>
><br>
> Thanks for speedy reply.<br>
><br>
> It seems effective in SNES.<br>
><br>
> I'm curious about how it works in iterative solver.<br>
> Let's say I'm using CG with BJACOBI for modified newton, if I Set lag as 5,<br>
> does that mean the ilu decomposition for pc is stored and reused for the<br>
> next 4 iterations? Will this setting help to reduce the iteration number of<br>
> ksp solver?<br>
<br>
</span>Reusing the preconditioner with a new operator will generally converge<br>
more slowly (or sometimes not at all).  Solving the stale linear system<br>
may cause modified Newton to stagnate/fail, e.g., when it chooses a<br>
search direction that is not a descent direction.<br>
<span class=""><br>
> Also, I'm wondering how to set the same option for just linear KSP solver<br>
> since I have coded the modified newton framework manually.<br>
<br>
</span>You can call KSPSolve() repeatedly without KSPSetOperators.  You can<br>
also use KSPSetReusePreconditioner to reuse the preconditioner that was<br>
set up in a previous solve.<br>
</blockquote></div><br></div>