On Fri, Nov 21, 2014 at 11:05 PM, Anush Krishnan <[email protected]> wrote:
> > > On 21 November 2014 18:23, Barry Smith <[email protected]> wrote: > >> >> > On Nov 21, 2014, at 5:09 PM, Anush Krishnan <[email protected]> wrote: >> > >> > Hello petsc-users, >> > >> > I've been running some CFD simulations, and I ran into one case where >> the system (which is a coupled system for pressure and body forces) did not >> converge and the reason was KSP_DIVERGED_INDEFINITE_PC. The options I'm >> using are -pc_gamg_agg_nsmooths 1 -pc_type gamg -pc_gamg_type agg with a >> conjugate gradient solver. >> >> We've heard reports of this happening before. You should increase the >> number of smoothing steps for the multigrid or change to a "stronger" >> smoother. >> >> What do you get with -ksp_view for exact solver you are using? >> > > I've attached a copy of the output with -ksp_view. > > >> Are you using PETSc's SNES? TS? Or just KSP? >> > > Just KSP. > > >> >> > >> > I saw in example ksp/pc/examples/tutorials/ex2.c that I should use the >> flag -pc_factor_shift_positive_definite to avoid this. >> >> This flag is only for factorization based preconditioners not gamg so >> you should not use it. >> >> > I have a few questions regarding this: >> > • What does it mean that the preconditioner is indefinite? >> >> It means that the preconditioner generated by GAMG has both negative >> and positive eigenvalues. CG cannot handle this, CG requires the >> preconditioner have all eigenvalues of the same sign. >> >> > What can cause this to happen? And what does the above flag do? >> > • The error occurs midway through the simulation. Is there any >> reason why this might be the case? The left-hand side matrix does not >> change during the simulation. >> >> Huh? If the matrix is not changing then the preconditioner should not >> be changing and hence the preconditioner should not be rebuilt and hence >> you should not see this message "midway through the simulation". Are you >> sure that the matrix is not changing?? >> > > Yes, I'm sure that the matrix is not changing. Only the right hand side > vector changes every time step. > > I have heard that CG sometimes converges even if the matrix is not > positive definite - do you think that might be happening? Also, is there a > way to check if a given matrix is positive definite using PETSc? And is it > possible to > That is possible. It is much more expensive to verify indefiniteness than to solve the system. I recommend you increase the smoothing as Barry suggested. Thanks, Matt > generate an indefinite preconditioner from a matrix that is symmetric > positive definite (I remember seeing a thread about this recently)? > > >> >> >> > • Do both -pc_factor_shift_positive_definite and >> -pc_factor_shift_type POSITIVE_DEFINITE do the same thing? >> >> Yes, they are from different versions of PETSc, but neither are for >> gamg. >> >> Barry >> >> > Thank you, >> > >> > Anush >> > >> >> > -- 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
