Dear PETSC Users, I try to solve a diffusion problem in the time domain. Its system matrix is theoretically SPD. I use KSPCG solver. Direct MUMPS solver generates a preconditioner. Thus, within 1-2 iterations, a solution is expected to converge. Such convergence is observed in most test problems. However, in some test problems, I get non-convergence with a message: KSP_DIVERGED_INDEFINITE_PC. This problem is alleviated when I use PCFactorSetShiftType(pc_fetd_dt,MAT_SHIFT_POSITIVE_DEFINITE). However, the indefiniteness error message occurs later during time-stepping. I am aware of PETSC function PCFactorSetShiftAmount. However, before I try this, I couldn't find the information about a default shift amount when I use PCFactorSetShiftType(pc_fetd_dt,MAT_SHIFT_POSITIVE_DEFINITE). How can I find the default shift amount?
More generally, how can I stably solve SPD problems that are close to indefiniteness using KSP options? To get the reference solution, I was able to solve the same problem above using SuiteSparse (serial) but its solution time was not practical. In advance, thanks for your advice. Regards, Evan Sample Code: KSPCreate(PETSC_COMM_WORLD, &ksp_fetd_dt); KSPSetOperators(ksp_fetd_dt, A_dt, A_dt); KSPSetType (ksp_fetd_dt, KSPPREONLY); KSPGetPC(ksp_fetd_dt, &pc_fetd_dt); MatSetOption(A_dt, MAT_SPD, PETSC_TRUE); PCSetType(pc_fetd_dt, PCCHOLESKY); PCFactorSetMatSolverPackage(pc_fetd_dt, MATSOLVERMUMPS); PCFactorSetUpMatSolverPackage(pc_fetd_dt); PCFactorGetMatrix(pc_fetd_dt, &F_dt); KSPSetType(ksp_fetd_dt, KSPCG); PCFactorSetShiftType(pc_fetd_dt,MAT_SHIFT_POSITIVE_DEFINITE);
