KSPMonitorTrueResidualNorm and SNES
Lukasz Kaczmarczyk
likask at civil.gla.ac.uk
Wed Oct 28 17:28:22 CDT 2009
Hello
No for example:
./ex5 -ksp_monitor_true_residual -snes_monitor
This problem is not reproduced.
My apologies for taking your time for stupid error, I called explicitly
ierr = SNESGetKSP(snes,&ksp); CHKERRQ(ierr);
ierr = KSPSetFromOptions(ksp); CHKERRQ(ierr);
ierr = SNESSetFromOptions(snes);CHKERRQ(ierr);
As an excuse I tell that reading manual I take impression that KSP
should be set up independently, and it was ok until I start to look at
true residual norm. I should not call KSPSetFromOptions().
Regards,
Lukasz
On 28 Oct 2009, at 21:07, Matthew Knepley wrote:
> On Wed, Oct 28, 2009 at 3:32 PM, Lukasz Kaczmarczyk <likask at civil.gla.ac.uk
> > wrote:
>
> I will switch off monitor after first linear solution phase using
> KSPMonitorCancel. SNESSetFromOptions should set up it once again
> Unfortunately this is not working.
>
> Can you reproduce this with an example, like SNES ex5?
>
> Matt
>
> 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
>
> --
> 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