[petsc-users] Question on KSPSetReusePreconditioner
Yuyun Yang
yyang85 at stanford.edu
Thu Apr 18 20:53:36 CDT 2019
I see, thanks for the helpful answers!
Best regards,
Yuyun
Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Smith, Barry F. <bsmith at mcs.anl.gov>
Sent: Thursday, April 18, 2019 3:51:27 PM
To: Yuyun Yang
Cc: petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] Question on KSPSetReusePreconditioner
> On Apr 18, 2019, at 10:44 AM, Yuyun Yang via petsc-users <petsc-users at mcs.anl.gov> wrote:
>
> Hello team,
>
> I have a question on when I should be setting KSPSetReusePreconditioner to PETSC_TRUE or PETSC_FALSE. It made a pretty big difference in the solutions I get when I ran my code testing both settings, so is recalculating the preconditioner better since it will make the convergence faster and the solution more accurate?
Reusing the preconditioner should have no significant impact on the accuracy of the solution to the linear system. The answers will be different but that should only be up to the tolerance you provided with -ksp_rtol But after many time-steps the final "answer" to the time dependent problem may be very different with different preconditioning approaches due to accumulation of different round-offs. But if both preconditioner approaches solve the linear system to the same accuracy then neither answer is more correct than the other.
> On the other hand, if the operator is updated every time step (but same nonzero pattern), will reconstructing the pc become time-consuming?
Whether to reuse the preconditioner depends completely on the problem. Reuse means more linear iterations but less setup time (for the preconditioner). So the relative cost of iterations to setup time dictates the optimal use of KSPSetReusePreconditioner() and can only be determined by making some timing runs with different choices and picking the one that seems fastest for your problem.
Barry
>
> Thank you!
> Yuyun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190419/e2d9f67e/attachment-0001.html>
More information about the petsc-users
mailing list