[petsc-users] Question with preconditioned resid norm and true resid norm

Matthew Knepley knepley at gmail.com
Thu Apr 17 16:22:59 CDT 2014


On Thu, Apr 17, 2014 at 4:17 PM, Song Gao <song.gao2 at mail.mcgill.ca> wrote:

> Hello,
>
> I am using KSP framework to solve the problem   A \Delta x = b in the
> matrix free fashion. where A is the matrix free matrix. I have another
> assembled matrix for preconditioning, but I'm NOT using it.  My code is not
> working so I'm debugging it.
> I run the code with options -ksp_pc_side left -ksp_max_it 10
> -ksp_gmres_restart 30 -ksp_monitor_true_residual -pc_type none -ksp_view
>
> I think if pc_type is none, the precondiitoned resid norm should equal to
> true resid norm (Am I correct?). But this doesn't happen. So maybe it would
> be helpful if I know how preconditioned resid norm and true resid norm are
> computed.
>
> Website says true resid norm is just b - A \Delta x.   But how is
> preconditioned resid norm computed? Any suggestions? Thank you very much.
>

The easiest explanation here is that your operator A is not behaving
linearly. Instead of MFFD, use the default FD with coloring
to create the whole matrix. That should behave as we expect for GMRES
(monotonically). If so, its a matter of debugging the
function evaluation.

   Matt


>   0 KSP preconditioned resid norm 9.619278462343e-03 true resid norm
> 9.619278462343e-03 ||r(i)||/||b|| 1.000000000000e+00
>   1 KSP preconditioned resid norm 9.619210849854e-03 true resid norm
> 2.552369536916e+06 ||r(i)||/||b|| 2.653389801437e+08
>   2 KSP preconditioned resid norm 9.619210847390e-03 true resid norm
> 2.552458142544e+06 ||r(i)||/||b|| 2.653481913988e+08
>   3 KSP preconditioned resid norm 9.619210847385e-03 true resid norm
> 2.552458343191e+06 ||r(i)||/||b|| 2.653482122576e+08
>   4 KSP preconditioned resid norm 9.619210847385e-03 true resid norm
> 2.552458344014e+06 ||r(i)||/||b|| 2.653482123432e+08
>   5 KSP preconditioned resid norm 9.619210847385e-03 true resid norm
> 2.552458344015e+06 ||r(i)||/||b|| 2.653482123433e+08
> .......
> Linear solve did not converge due to DIVERGED_ITS iterations 10
> KSP Object: 1 MPI processes
>   type: gmres
>     GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
> Orthogonalization with no iterative refinement
>     GMRES: happy breakdown tolerance 1e-30
>   maximum iterations=10, initial guess is zero
>   tolerances:  relative=1e-06, absolute=1e-50, divergence=100000
>   left preconditioning
>   using PRECONDITIONED norm type for convergence test
> PC Object: 1 MPI processes
>   type: none
>   linear system matrix followed by preconditioner matrix:
>   Matrix Object:   1 MPI processes
>     type: mffd
>     rows=22905, cols=22905
>       Matrix-free approximation:
>         err=1.49012e-08 (relative error in function evaluation)
>         Using wp compute h routine
>             Does not compute normU
>   Matrix Object:   1 MPI processes
>     type: seqbaij
>     rows=22905, cols=22905, bs=5
>     total: nonzeros=785525, allocated nonzeros=785525
>     total number of mallocs used during MatSetValues calls =0
>         block size is 5
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140417/6c28f833/attachment.html>


More information about the petsc-users mailing list