[petsc-users] PC FieldSplit - How to Count the Iterations

Smith, Barry F. bsmith at mcs.anl.gov
Wed Mar 14 09:55:26 CDT 2018

   Matt can likely answer this but it is always better to try to figure out things yourself. Everything in PETSc is knowable to the user if you know the correct places to look.

    I would run in the debugger and put a break point in KSPSolve() then do a bt (or where) at each call to KSPSolve() to see why it is being called seemingly multiple times.

    You can also run with -xxx_ksp_converged_reason and -xxx_ksp_monitor to see when solvers are being called (where xxx are the prefix for the inner solves).


> On Mar 14, 2018, at 9:21 AM, Sonia Pozzi <sonia.pozzi at usi.ch> wrote:
> Dear Barry,
> thank you for the answer. That helped a lot. Just a second curiosity. 
> I’m setting A00 to be solved with preonly+lu. I obtain the following
> ksp_0  KSPGetTotalIterations: 26
> ksp_1  KSPGetTotalIterations: 22
> Residual ksp_0: 0 Reason ksp_0: 4
> Solution ksp_0 :  Convergence in 1 iterations.
> Residual ksp_1: 5.23074e-14 Reason ksp_1: 2
> Solution ksp_1 :  Convergence in 11 iterations.
> Initial system linear residual:  9.904804e-09 
> To me is clear that kps_0 iterations number is equal to 22*1+2*2. 
> But why is the iterations number for the schur complement multiplied by two?
> I’m giving the mass matrix as a preconditioner for the schur complement.
> Sonia
> Ph.D. Student
> Group of Prof. Rolf Krause
> Institute of Computational Science
> Università della Svizzera italiana
> Center for Computation Medicine in Cardiology
> Via Giuseppe Buffi, 13
> CH-6900 Lugano
> Switzerland
> Email: pozzis at usi.ch 
> Phone: +41 58 666 4972
>> On 14 Mar 2018, at 14:52, Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
>> KSPGetIterationNumber

More information about the petsc-users mailing list