[petsc-users] Problem about Residual evaluation

Matthew Knepley knepley at gmail.com
Mon Apr 1 11:46:27 CDT 2019


On Mon, Apr 1, 2019 at 12:36 PM Fande Kong <fdkong.jd at gmail.com> wrote:

> On Mon, Apr 1, 2019 at 10:24 AM Matthew Knepley via petsc-users <
> petsc-users at mcs.anl.gov> wrote:
>
>> On Mon, Apr 1, 2019 at 10:22 AM Yingjie Wu via petsc-users <
>> petsc-users at mcs.anl.gov> wrote:
>>
>>> Dear PETSc developers:
>>> Hi,
>>>
>>> I've been using -snes_mf_operator and I've customized a precondition
>>> matrix to solve my problem.I have two questions about the residuals of
>>> linear steps(KSP residual).
>>>
>>>
>>> 1.Since I'm using a matrix-free method, how do we get KSP residuals in
>>> PETSc?
>>>
>>> r_m = b - A*x_m
>>>
>>> Is finite difference used to approximate "A*x_m" ?
>>>
>>
>> Yes.
>>
>>
>>> 2.What is the difference between instruction ' -ksp_monitor ' and '
>>> -ksp_monitor_true_residual ' in how they are calculated?
>>>
>>
>> The true residual is the unpreconditioned residual.
>>
>
> I actually have some specific understanding on "
> -ksp_monitor_true_residual", but not sure it is right or not.  If I am
> wrong, please correct me.
>
> When the preconditioning  matrix is super ill-conditioned, the ``true
> residual" is not necessary ``true"  for the right preconditioning since an
> unwind process is applied.  That is,   "-ksp_monitor_true_residual" does
> not print ||b-Ax||, instead, it prints  the unpreconditioned residual by
> unpreconditioning  the preconditioned residual.
>

This calls KSPBuildResidual(). Everything but GCR calls
KSPBuildResidualDefault(). This just computes b - Ax.
What you may be talking about is how you get x when you are right
preconditioning. This calls KSPBuildSolution().
With right preconditioning, you must apply the preconditioner to get back
to the original space, but this IS EXACTLY
the true residual.

  Thanks,

    Matt


> Thanks,
>
> Fande,
>
>
>
>>
>>   Matt
>>
>>
>>> Thanks,
>>>
>>> Yingjie
>>>
>>>
>>>
>>>
>>
>> --
>> 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
>>
>> https://www.cse.buffalo.edu/~knepley/
>> <http://www.cse.buffalo.edu/~knepley/>
>>
>

-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190401/ffe3ef8d/attachment.html>


More information about the petsc-users mailing list