[petsc-users] PETSC for singular system
Yaxiong Chen
chen2018 at purdue.edu
Thu Jan 10 21:56:44 CST 2019
Hello,
I am trying to use PETSC to solve a singular system like the following.
[cid:ef7b4672-623e-48d7-b9fa-6e8d4ed67b5f].
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)
[cid:0c347c3e-462d-4fe8-9718-273339c2c1f2]
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?
Thanks
Yaxiong Chen,
School of Mechanical Engineering, 3171
585 Purdue Mall
West Lafayette, IN 47907
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190111/bb05442b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 2573 bytes
Desc: pastedImage.png
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190111/bb05442b/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pastedImage.png
Type: image/png
Size: 3538 bytes
Desc: pastedImage.png
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190111/bb05442b/attachment-0003.png>
More information about the petsc-users
mailing list