[petsc-users] Question about ksp ex3.c

Jed Brown jedbrown at mcs.anl.gov
Tue Sep 20 05:44:35 CDT 2011


On Tue, Sep 20, 2011 at 11:45, Matija Kecman <matijakecman at gmail.com> wrote:

> $ mpirun -np 1 ./ex3 -ksp_type gmres -pc_type none -m 100
> Norm of error 0.570146 Iterations 0
>

This uses a nonzero initial guess so the initial residual norm is compared
to the right hand side.

$ ./ex3 -ksp_type gmres -ksp_monitor -m 100 -pc_type none
-ksp_converged_reason -info |grep Converged
[0] KSPDefaultConverged(): user has provided nonzero initial guess,
computing 2-norm of preconditioned RHS
[0] KSPDefaultConverged(): Linear solver has converged. Residual norm
1.113646413065e-04 is less than relative tolerance 1.000000000000e-05 times
initial right hand side norm 1.291007358616e+01 at iteration 0

You can use the true residual, it just costs something so it's not enabled
by default:

$ ./ex3 -ksp_type gmres -ksp_monitor -m 100 -pc_type none
-ksp_converged_reason -ksp_converged_use_initial_residual_norm
[many iterations]
Linear solve converged due to CONVERGED_RTOL iterations 1393
Norm of error 0.000664957 Iterations 1393
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110920/a87aafdf/attachment.htm>


More information about the petsc-users mailing list