[petsc-users] PETSC for singular system

Smith, Barry F. bsmith at mcs.anl.gov
Mon Jan 14 13:15:05 CST 2019



> On Jan 14, 2019, at 7:26 AM, Matthew Knepley via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> On Mon, Jan 14, 2019 at 7:55 AM Yaxiong Chen <chen2018 at purdue.edu> wrote:
> So must I  figure out the index of the zero columns and row to get the null space first, And then I remove it to generator Cholesky or LU preconditionor?Is this case, should the nontrivial null space be (1,0,0,0)?
> 
> No
> 
> 1) If you have a consistent rhs, then CG works as is. However, you should put it in in case your preconditioner introduces nullspace components.
> 
> 2) Factorization will NEVER work on singular systems, unless you use SVD, which is only for very small systems.
> 
>   Thanks,
> 
>     Matt
>  
> Thanks
> Get Outlook for iOS
> _____________________________
> From: Matthew Knepley <knepley at gmail.com>
> Sent: Monday, January 14, 2019 2:00 AM
> Subject: Re: [petsc-users] PETSC for singular system
> To: Yaxiong Chen <chen2018 at purdue.edu>, PETSc <petsc-maint at mcs.anl.gov>
> 
> 
> On Sun, Jan 13, 2019 at 6:59 PM Yaxiong Chen <chen2018 at purdue.edu> wrote:
> Hello Matthew,
> 
> 
> 
> Does this mean in PETSC , CG is not suitable for semi positive definite system?
> 
> No, it means factorization is not. CG is fine.
> 
>   Matt
>  
>  My  system is equivalent to a SPD system with arbitrary extra rows and columns of zeros. I expect the same iteration process will lead to xT=(0,1,1,1) with initial guess 0, since the rows of 0 will not influence the corresponding solution. Is this possible to be realized with CG in PETSC?

    This is only true for unpreconditioned CG or CG with some trivial preconditioner; but these will converge slowly and not be practical.

     What you need to do is go back to your original formulation and construct a matrix that does not have the zero rows and columns; they are not needed and just mess up the solver big time.

    Barry

> 
> Thanks
> 
> 
> Yaxiong Chen, 
> 
> Ph.D. Student 
> 
> 
> School of Mechanical Engineering, 3171 
> 
> 585 Purdue Mall
> 
> West Lafayette, IN 47907
> 
> 
> 
> 
> 
> 
> 
> 
> From: Matthew Knepley <knepley at gmail.com>
> Sent: Friday, January 11, 2019 2:30 PM
> To: Yaxiong Chen
> Cc: PETSc
> Subject: Re: [petsc-users] PETSC for singular system
>  
> On Fri, Jan 11, 2019 at 10:04 AM Yaxiong Chen via petsc-users <petsc-users at mcs.anl.gov> wrote:
> Hello, 
> 
> I am trying to use PETSC to solve a singular system like the following.
> <pastedImage.png>.
> This equals inserting rows and columns at arbitrary place(Actually I even don't know whether it is singular or not. Sometimes some degree of freedom x_i may not participate in the global matrix)
> <pastedImage.png>
> I searched some discussion online and tried to remove the nullspace with the following code:
>      call KSPCreate(PETSC_COMM_WORLD,ksp,ierr)
>      call KSPSetOperators(ksp,Amat,Amat,ierr)
>      call KSPSetFromOptions(ksp,ierr)
>      call KSPSetType(ksp, KSPCG,ierr) 
>      call MatNullSpaceCreate( PETSC_COMM_WORLD, PETSC_TRUE, 0, dummyVecs, nullspace, ierr)
>      call MatSetNullSpace(Amat,nullspace,ierr)
>      call MatNullSpaceDestroy(nullspace,ierr)
>      call KSPSolve(ksp,bvec,xvec,ierr)
> 
> But it still gives me some error saying Zero pivot in LU factorization.
> I am just wondering how MatSetNullSpace() can handle this?
> 
> If you give the nullspace, the Kryloc method will work. However, you still cannot use factorization. So
> 
> 1) -ksp_type gmres -pc_type jacobi will solve your system
> 
> 2) -ksp_type gmres -pc_type svd will solve your system
> 
> Saying anything more general than that is really not possible.
> 
>   Thanks,
> 
>     Matt
>  
> Thanks
> 
> 
> Yaxiong Chen, 
> 
> School of Mechanical Engineering, 3171 
> 
> 585 Purdue Mall
> 
> West Lafayette, IN 47907
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/
> 
> 
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.
> -- Norbert Wiener
> 
> https://www.cse.buffalo.edu/~knepley/



More information about the petsc-users mailing list