[petsc-users] PETSC for singular system

Matthew Knepley knepley at gmail.com
Fri Jan 11 13:30:18 CST 2019


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.
>
> .
>
> 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)
>
>
> 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/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190111/2b1ded17/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 2573 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190111/2b1ded17/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 3538 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190111/2b1ded17/attachment-0001.png>


More information about the petsc-users mailing list