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>