<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/4.6.6">
</HEAD>
<BODY>
Barry,<BR>
<BR>
this helped a lot.<BR>
I do multiple solves with the operator changing at each solve. Without forcing recomputing the preconditioner and setting explicitly KSPSetReusePreconditioner,<BR>
I mostly get "PCSetUp(): Leaving PC with identical preconditioner since operator is unchanged" and a few times "PCSetUp(): Setting up PC with same nonzero pattern".<BR>
Shouldn't I get "PCSetUp(): Setting up PC with same nonzero pattern" all the times since the operator keeps changing?<BR>
I am solving with CG + MG with coarse operators computed via Galerkin process. <BR>
<BR>
Michele <BR>
<BR>
<BR>
<BR>
<BR>
On Thu, 2015-07-09 at 15:06 -0500, Barry Smith wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Run with -info ; it prints lots of stuff but you can grep for PCSetUp and you'll see a message such as
Setting up PC for first time
Leaving PC with identical preconditioner since operator is unchanged
Setting up PC with different nonzero pattern\n");CHKERRQ(ierr);
Setting up PC with same nonzero pattern
or
Leaving PC with identical preconditioner since reuse preconditioner is set
<FONT COLOR="#737373">> On Jul 9, 2015, at 2:45 PM, Michele Rosso <<A HREF="mailto:mrosso@uci.edu">mrosso@uci.edu</A>> wrote:</FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> Barry,</FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> thanks you for your help.</FONT>
<FONT COLOR="#737373">> Is there a database options that allows me to check weather PC has been recomputed or kept the same?</FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> Thanks,</FONT>
<FONT COLOR="#737373">> Michele </FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> </FONT>
<FONT COLOR="#737373">> On Thu, 2015-07-09 at 14:43 -0500, Barry Smith wrote:</FONT>
<FONT COLOR="#737373">>> 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.</FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> You only need to destroy the KSP or call KSPReset() when you change the size of the vectors or matrices.</FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> Barry</FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> > On Jul 9, 2015, at 12:20 PM, Michele Rosso <<A HREF="mailto:mrosso@uci.edu">mrosso@uci.edu</A>> wrote:</FONT>
<FONT COLOR="#737373">>> > </FONT>
<FONT COLOR="#737373">>> > Hi,</FONT>
<FONT COLOR="#737373">>> > </FONT>
<FONT COLOR="#737373">>> > 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. </FONT>
<FONT COLOR="#737373">>> > 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.</FONT>
<FONT COLOR="#737373">>> > Could you help please?</FONT>
<FONT COLOR="#737373">>> > </FONT>
<FONT COLOR="#737373">>> > </FONT>
<FONT COLOR="#737373">>> > Thanks,</FONT>
<FONT COLOR="#737373">>> > Michele</FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">>> </FONT>
<FONT COLOR="#737373">> </FONT>
</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>