dmmg residuals and AMG

Nicolas Bathfield nicolas.bathfield at
Wed Dec 13 08:39:00 CST 2006

Dear Barry and Petsc users,

I dig into the code to understand a bit better the output from the options
-ksp_view -dmmg_ksp_monitor, but I am still confused (There is a printout
of ksp/ksp/example/tutorial/ex29.c slightly modified below).

What does the first index (0,1,2 or 3)in front of KSP residual represent?

-ksp_view gives:
 MG: type is FULL, levels=3 cycles=1, pre-smooths=1, post-smooths=1;
Does that really mean that I perform only 1 multigrid cycle? How can I
control the number of cycles and the convergence criteria?

Thanks for your help.

Best regards,


      0 KSP Residual norm 1.421285957034e-02
      1 KSP Residual norm 1.609288367464e-03
      0 KSP Residual norm 2.699978999993e-01
      1 KSP Residual norm 3.406567948849e-02
      0 KSP Residual norm 2.101495954238e-02
      1 KSP Residual norm 1.846013302069e-03
      0 KSP Residual norm 8.326606206788e-04
      1 KSP Residual norm 4.344001727320e-05
      0 KSP Residual norm 1.577985727128e-02
      1 KSP Residual norm 1.969730522207e-03
      1 KSP Residual norm 2.116914409872e-02
      0 KSP Residual norm 1.029801283683e-01
      1 KSP Residual norm 7.594550723847e-03
      0 KSP Residual norm 7.254183286194e-03
      1 KSP Residual norm 6.000261158570e-04
      0 KSP Residual norm 2.966998198077e-01
      1 KSP Residual norm 5.201133083048e-02
      0 KSP Residual norm 3.786415700595e-02
      1 KSP Residual norm 3.901313528873e-03
      0 KSP Residual norm 3.502275405186e-03
      1 KSP Residual norm 2.803439371866e-04
      0 KSP Residual norm 2.150042336470e-02
      1 KSP Residual norm 3.280472811048e-03
      2 KSP Residual norm 1.206584038156e-04
      0 KSP Residual norm 1.010495676349e-01
      1 KSP Residual norm 5.373641377818e-03
      0 KSP Residual norm 3.177241089754e-03
      1 KSP Residual norm 2.956553309307e-04
      0 KSP Residual norm 2.439978649540e-01
      1 KSP Residual norm 2.775398636052e-02
      0 KSP Residual norm 2.197619585488e-02
      1 KSP Residual norm 1.465557162804e-03
      0 KSP Residual norm 1.119259726469e-03
      1 KSP Residual norm 6.758059074616e-05
      0 KSP Residual norm 1.390217147343e-02
      1 KSP Residual norm 1.994861880977e-03
      3 KSP Residual norm 5.385911324388e-07
    KSP Object:
      type: fgmres
        GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
Orthogonalization with no iterative refinement
        GMRES: happy breakdown tolerance 1e-30
      maximum iterations=10000, initial guess is zero
      tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
      right preconditioning
    PC Object:
      type: mg
        MG: type is FULL, levels=3 cycles=1, pre-smooths=1, post-smooths=1
      Coarse gride solver -- level 0 -------------------------------
        KSP Object:(mg_coarse_)
          type: preonly
          maximum iterations=1, initial guess is zero
          tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
          left preconditioning
        PC Object:(mg_coarse_)
          type: lu
            LU: out-of-place factorization
              matrix ordering: nd
            LU: tolerance for zero pivot 1e-12
            LU: factor fill ratio needed 1.54545
                 Factored matrix follows
                Matrix Object:
                  type=seqaij, rows=9, cols=9
                  total: nonzeros=51, allocated nonzeros=51
                    not using I-node routines
          linear system matrix = precond matrix:
          Matrix Object:
            type=seqaij, rows=9, cols=9
            total: nonzeros=33, allocated nonzeros=33
              not using I-node routines

> On Mon, 11 Dec 2006, Nicolas Bathfield wrote:
>>  Hi,
>> I would like to compare PETSc DMMG convergence to some theoretical
>> convergence rate given by local Fourier analysis for a simple diffusion
>> problem.
>> To do so, I need to extract the residuals after each multigrid
>> iteration.
>> Unfortunately, I only managed to obtain the residuals at the last
>> iteration.
>> Is it possible to get the residual printed out after each multigrid
>> iteration without modifying the source code?
>   Nicolas,
>   -dmmg_ksp_monitor prints the residual after each V/W cycle.
> -pc_mg_monitor
> prints the residual norm before and after each smoothing step.
>   BTW: always run with -ksp_view to see exactly what solver options
> are being used. The defaults are non-standard (e.g. we default to having a
> Krylov solver turned on for each smoother and the V/W cycle).
>> Furthermore, I'd like to test the AMG from the PC type from HYPRE
>> (boomeramg). I have already ran --download-hypre while compiling petsc.
>> Is
>> there any example available somewhere?
>   -pc_type hypre -pc_hypre_type boomeramg
> Run with -help to see the boomeramg options; again use -ksp_view we
> default
> to accelerating boomeramg with GMRES which is non-standard. Use -ksp_type
> richardson
> to get the usual V/W cycle.
>   Good luck,
>    Barry
> Why the non-standard defaults? We want to provide a default MG that is as
> robust
> (more likely to converge) as possible. Hence we turn on ILU(0) smoothing
> with GMRES
> acceleration of the smoother and Krylov method. You can turn off these
> options one
> at a time to see the effect on the convergence rate. For model problems
> the accelerators
> only improve convergence a little. For more complex problems, for example
> src/snes/examples/tutorials/ex19.c
> convergence gets much worse without the accelerators.
>> Best regards,
>> Nicolas.
>>  --
>>  Nicolas BATHFIELD
>>  Chalmers University of Technology
>>  Shipping and Marine Technology
>>  phone: +46 (0)31 772 1476
>>  fax:   +46 (0)31 772 3699

Chalmers University of Technology
Shipping and Marine Technology
phone: +46 (0)31 772 1476
fax:   +46 (0)31 772 3699

More information about the petsc-users mailing list