[petsc-users] Recomputing ksp

Michele Rosso mrosso at uci.edu
Thu Jul 9 14:45:28 CDT 2015


thanks you for your help.
Is there a database options that allows me to check weather PC has been
recomputed or kept the same?


On Thu, 2015-07-09 at 14:43 -0500, Barry Smith wrote:

>    By default in the last two PETSc releases KSP automatically updates the preconditioner whenever the matrix you set with KSPSetOperators() has been changed. That is you have to do nothing and PETSc will recompute the preconditioner as needed. If you wish to keep the same preconditioner even though the matrix has changed then you can use KSPSetReusePreconditioner(ksp,PETSC_TRUE) and it will keep using the same preconditioner until you call KSPSetReusePreconditioner(ksp,PETSC_FALSE) which will switch back to the default mode.
>   You only need to destroy the KSP or call KSPReset() when you change the size of the vectors or matrices.
>   Barry
> > On Jul 9, 2015, at 12:20 PM, Michele Rosso <mrosso at uci.edu> wrote:
> > 
> > Hi,
> > 
> > I need to recompute the preconditioner every once in a while. So far I do this "manually", i.e. I destroy ksp and re-create and reset it whenever needed. 
> > I am wondering if there is a cleaner way of doing this via a PETSc function. I found KSPreset but there are no examples about it so I am not sure it is what I am looking for.
> > Could you help please?
> > 
> > 
> > Thanks,
> > Michele

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150709/238ba3ec/attachment.html>

More information about the petsc-users mailing list