KSPMonitorTrueResidualNorm and SNES
Lukasz Kaczmarczyk
likask at civil.gla.ac.uk
Wed Oct 28 13:51:18 CDT 2009
Thank you for answer. What you described bellow is my case. I
initially solve linear problem using KSP only. To set up solver the
KSPSetFromOptions is used. Having initial data I solve nonlinear time
dependent problem using SNES set up by SNESSetFromOptions.
I will switch off monitor after first linear solution phase using
KSPMonitorCancel. SNESSetFromOptions should set up it once again.
Kind regards
Lukasz
On 28 Oct 2009, at 16:40, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> You are calling SNESSetFromOptions() or KSPSetFromOptions() twice.
> If you call it once the problem won't appear.
>
> There is an extremely ugly hack that is implemented for the
> default monitor, but not other monitors, to prevent this double
> printing. Whoever wrote this ugly hack should have done it properly.
>
> Barry
>
> On Oct 28, 2009, at 2:39 AM, Lukasz Kaczmarczyk wrote:
>
>> Hi Matt
>>
>> I add monitor from options only.
>>
>> Pleas note that for default KSP monitor a norm of preconditioned
>> residual is printed only once. Problem exists when I monitor true
>> residuals.
>>
>> Regards,
>> Lukasz
>>
>>
>>
>> On 27 Oct 2009, at 23:23, Matthew Knepley <knepley at gmail.com> wrote:
>>
>>> It is possible to add the monitor twice. Are you sure this did not
>>> happen?
>>>
>>> Thanks,
>>>
>>> Matt
>>>
>>> On Tue, Oct 27, 2009 at 6:19 PM, Lukasz Kaczmarczyk <likask at civil.gla.ac.uk
>>> > wrote:
>>> Hello,
>>>
>>> I have noticed minor problem, potentially bug. For nonlinear
>>> analysis with SNES and option -ksp_monitor_true_residual I get
>>> 0 Norm Res_strain 9.36e-12 Norm Res_stress 1.43e-05 Internal its 1
>>> 0 SNES Function norm 1.428489691212e-05
>>> 0 KSP preconditioned resid norm 7.213823259362e-04 true resid
>>> norm 1.428489691212e-05 ||Ae||/||Ax|| 1.000000000000e+00
>>> 0 KSP preconditioned resid norm 7.213823259362e-04 true resid
>>> norm 1.428489691212e-05 ||Ae||/||Ax|| 1.000000000000e+00
>>> 1 KSP preconditioned resid norm 4.903423697449e-04 true resid
>>> norm 9.339595309685e-06 ||Ae||/||Ax|| 6.538090801174e-01
>>> 1 KSP preconditioned resid norm 4.903423697449e-04 true resid
>>> norm 9.339595309685e-06 ||Ae||/||Ax|| 6.538090801174e-01
>>>
>>> It look that function KSPMonitorTrueResidualNorm is evaluated
>>> twice, whereas for default KSP monitor only once. I use
>>> petsc-3.0.0-p7.
>>>
>>> Kind regards,
>>> Lukasz
>>>
>>>
>>>
>>> --
>>> 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
>
>
More information about the petsc-users
mailing list