[petsc-users] KSP with MatNullSpace

Shiyuan gshy2014 at gmail.com
Wed Nov 23 13:31:06 CST 2011


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);
Thanks.

On Wed, Nov 23, 2011 at 1:26 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
>   Print out the matrix for a small grid then check in Matlab that it is
> symmetric and has no negative eigenvalues.
>
>   Barry
>
>
> On Nov 23, 2011, at 9:50 AM, Shiyuan wrote:
>
> > Hi,
> >     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.
> > this is how I setup the system. What did I do wrong? Any possible
> causes? Thanks.
> >
> >
>  ierr=MatNullSpaceCreate(PETSC_COMM_SELF,PETSC_FALSE,1,&phi,&nsp);CHKERRV(ierr);
> >   ierr=KSPCreate(PETSC_COMM_SELF,&ksp);CHKERRV(ierr);
> >   ierr=KSPSetOperators(ksp,A,A,DIFFERENT_NONZERO_PATTERN);CHKERRV(ierr);
> >   ierr=KSPSetNullSpace(ksp,nsp);CHKERRV(ierr);
> >   ierr=KSPSetType(ksp,KSPCG);CHKERRV(ierr);
> >   ierr=KSPGetPC(ksp,&prec);CHKERRV(ierr);
> >   ierr=PCSetType(prec,PCNONE);CHKERRV(ierr);
> >   ierr=KSPSetTolerances(ksp,1e-5,1e-20,1e5,10000);CHKERRV(ierr);
> >   ierr=KSPSetFromOptions(ksp);CHKERRV(ierr);
> >   ierr=KSPSetUp(ksp);CHKERRV(ierr);
> >
> > Shiyuan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20111123/940092a4/attachment.htm>


More information about the petsc-users mailing list