I notice that when the vector indicating the nullspace is not very accurate (norm(A*phi) very small but not zero), KSP (CG) will return KSP_INDEFINITE_PC. When b is very close to zero in AX=b, KSP (CG) has the same error. Is it controlled by some tolerance? How can I set the tolerance? Thanks. <div>
<br><div>Shiyuan <div><br><div class="gmail_quote">On Wed, Nov 23, 2011 at 5:00 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
On Nov 23, 2011, at 1:31 PM, Shiyuan wrote:<br>
<br>
> I've check it in Matlab. the matrix A is symmetric and has no negative eigenvalues( only a zero eigen value). I've also checked that the nullspace is correct( norm(A*phi)<1e-11);<br>
<br>
</div> Hmm. You can run with -ksp_view_binary and email to <a href="mailto:petsc-maint@mcs.anl.gov">petsc-maint@mcs.anl.gov</a> the resulting file called binaryoutput.<br>
<span class="HOEnZb"><font color="#888888"><br>
Barry<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
> Thanks.<br>
><br>
> On Wed, Nov 23, 2011 at 1:26 PM, Barry Smith <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:<br>
><br>
> Print out the matrix for a small grid then check in Matlab that it is symmetric and has no negative eigenvalues.<br>
><br>
> Barry<br>
><br>
><br>
> On Nov 23, 2011, at 9:50 AM, Shiyuan wrote:<br>
><br>
> > Hi,<br>
> > I want to solve a singular system with a known nullspace. However, I the KSP solve diverges with KSP_INDEFINTE_PC even if I disable the preconditioning by PCNONE.<br>
> > this is how I setup the system. What did I do wrong? Any possible causes? Thanks.<br>
> ><br>
> > ierr=MatNullSpaceCreate(PETSC_COMM_SELF,PETSC_FALSE,1,&phi,&nsp);CHKERRV(ierr);<br>
> > ierr=KSPCreate(PETSC_COMM_SELF,&ksp);CHKERRV(ierr);<br>
> > ierr=KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN);CHKERRV(ierr);<br>
> > ierr=KSPSetNullSpace(ksp,nsp);CHKERRV(ierr);<br>
> > ierr=KSPSetType(ksp,KSPCG);CHKERRV(ierr);<br>
> > ierr=KSPGetPC(ksp,&prec);CHKERRV(ierr);<br>
> > ierr=PCSetType(prec,PCNONE);CHKERRV(ierr);<br>
> > ierr=KSPSetTolerances(ksp,1e-5,1e-20,1e5,10000);CHKERRV(ierr);<br>
> > ierr=KSPSetFromOptions(ksp);CHKERRV(ierr);<br>
> > ierr=KSPSetUp(ksp);CHKERRV(ierr);<br>
> ><br>
> > Shiyuan<br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div></div></div>