On Thu, Aug 16, 2018 at 12:20 PM Josh L <[email protected]> wrote: > > > > 2018-08-16 10:39 GMT-05:00 Mark Adams <[email protected]>: > > Hi Mark, > > The problem I am running is simply 2-D linear elasticity, and I use > petsc's ex49 of KSP to do benchmark. > > I have solved the error by using MatZeroRowsColumns(diagonal =1.0) to > apply BC instead of MatZeroRows. > (My code is actually using newton's method to solve nonlinear problem(Now, > use it to run a linear elasticity problem), and the rhs entries for > Dirichlet BC is just zero, so either zerorowscolumns or zerorows gives the > same solution). > > With GMRES and gamg, the 120K degrees of freedoms linear elasticity > problem converges in 7 iterations. > But with " -ksp_type chebyshev -ksp_chebyshev_esteig_noisy" I still get > NAN residual that comes out of nowhere (it is not diverging. all of a > sudden NAN shows up) >
You want to use CG as the ksp type if it is symmetric (and positive definite). I would guess you don't need to zero columns but go ahead and do it, if it is easy. I am confused. I thought you were using '-ksp_type chebyshev' to debug Cheby errors when using GAMG. Anyway, with -ksp_type chebyshev you want to use CG in the eigen estimator. CG is much faster than GAMG. So you should use '-ksp_chebyshev_esteig_ksp_type cg'. And use -options_left to make sure that these parameters are getting in correctly. And you should use '-ksp_type cg'.
