The interface functions are https://petsc.org/release/docs/manualpages/PC/PCFactorSetShiftType.html https://petsc.org/release/docs/manualpages/PC/PCFactorSetShiftAmount.html
To check for success you can use https://petsc.org/release/docs/manualpages/KSP/KSPGetConvergedReason.html You can also use https://petsc.org/release/docs/manualpages/KSP/KSPSetErrorIfNotConverged.html if want to error out upon failure. For singular systems, you may want to try external packages such as MUMPS. Jose > El 12 jul 2022, a las 11:33, Ye Changqing <[email protected]> escribió: > > Dear all, > > I have a linear system constructed from discretizing a Neumann boundary value > problem, and I want to solve it with a direct solver (to build up my own > preconditioner). Usually, KSP returns a good solution without '-inf', while > sometimes it fails. I referred to the corresponding chapter in the manual and > found options '-pc_factor_shift_type' and '-pc_factor_shift_amount'. Could I > use those options in my codes rather than runtime? Moreover, In my case, the > program did not throw an error or warning due to '-inf' in the solution, I > also wondered how to check the solution is 'good'? > > Thanks, > Changqing
