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