[petsc-users] Divergence termination of KSP iteration despite disabled convergence test
Jed Brown
jed at 59A2.org
Wed Sep 8 05:28:33 CDT 2010
On Wed, 08 Sep 2010 12:13:27 +0200, Florian Rathgeber <florian.rathgeber at googlemail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> I instructed KSP (cg, jacobi) to run for a fixed number of CG iterations
> (for benchmarking purposes) by disabling convergence testing and norm
> computation as so:
>
> KSPSetConvergenceTest(ksp, KSPSkipConverged, PETSC_NULL, PETSC_NULL);
> KSPSetNormType(ksp, KSP_NORM_NO);
>
> This worked fine for all my tests but Poisson. I tried solving Poisson
> on P1, P2, and P3 elements with the right hand side 1 and no Dirichlet
> condition (the result was not supposed to be meaningful, it was just for
> benchmarking) and every time iteration terminated prematurely with
> reason KSP_DIVERGED_INDEFINITE_MAT (-10).
This does not come from a convergence test, CG computes the A-inner
product and the algorithm doesn't make sense if this is not an inner
product (detected when the algorithm computes (x,x)_A = x\cdot A\cdot x <= 0 for
some x).
> 1) I would expect KSPSkipConverged to disable the divergence check as well
> 2) I don't understand the divergence reason, how would the matrix
> suddenly become indefinite?
Perhaps an assembly problem (didn't assembly what you thought), or
(because it sounds like your matrix is singular), you got unlucky in
your problem choice so as to find an x such that (x,x)_A = 0. You can
check the matrix in a crude way with GMRES and -ksp_compute_eigenvalues,
or write it out with -ksp_view_binary, read it in with Matlab/Octave,
and check the spectrum there.
> So my question is: how to safely disable this divergence test so that
> KSP runs for the number of iterations I expect it to run?
Change the matrix or change the Krylov method.
Jed
More information about the petsc-users
mailing list