<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 24, 2013 at 3:24 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Dmitry Karpeyev <<a href="mailto:karpeev@mcs.anl.gov">karpeev@mcs.anl.gov</a>> writes:<br>
<br>
> It appears that SNESConvergedDefault() sets snes->ttol here<br>
> <a href="https://bitbucket.org/petsc/petsc/src/40bc6eb114e6a8e7f27fd216b5c1226efddf337a/src/snes/interface/snesut.c?at=master#cl-462" target="_blank">https://bitbucket.org/petsc/petsc/src/40bc6eb114e6a8e7f27fd216b5c1226efddf337a/src/snes/interface/snesut.c?at=master#cl-462</a><br>
><br>
> That should be harmless, albeit unnecessary, since snes->ttol is also set<br>
> at the beginning of the solve in SNESSolve_NEWTONLS() (and other<br>
> SNESSolve_XXX) right before calling the convergence test:<br>
> <a href="https://bitbucket.org/petsc/petsc/src/40bc6eb114e6a8e7f27fd216b5c1226efddf337a/src/snes/impls/ls/ls.c?at=master#cl-202" target="_blank">https://bitbucket.org/petsc/petsc/src/40bc6eb114e6a8e7f27fd216b5c1226efddf337a/src/snes/impls/ls/ls.c?at=master#cl-202</a><br>
><br>
><br>
> However, this might make for some fragile code and may confuse the user<br>
> modeling a custom convergence test on SNESConvergedDefault(). In<br>
> particular, a local reading of SNESConvergedDefault() creates the<br>
> impression that it is the convergence monitor that is responsible for<br>
> setting snes->ttol on the zeroth iteration -- snes->ttol is used outside of<br>
> SNES, for example, in one of the variants of the EW code (maybe only<br>
> there). That would require access to SNES internals by user code.<br>
<br>
</div>Well, when using SNESSkipConverged (should have been named<br>
SNESConvergedSkip when changing to SNESConvergedDefault!), we don't need<br>
an initial function norm, so setting ttol outside the convergence test<br>
is wasteful. (I'm thinking in terms of reductions when using an<br>
inexpensive SNES iteration like a point smoother.) If the convergence<br>
test implementation wants to use a relative tolerance, then it should<br>
store the target tolerance (or equivalently, the initial residual) in<br>
its own context. I think all reference to ttol should be removed from<br>
outside the convergence tests.<br></blockquote><div>Yes. How should EW version 3 be implemented then?</div><div>Currently EW3 piggybacks on snes->ttol to get a measure of the initial norm of the residual,</div><div>and relies on it having been set elsewhere. If no references to snes->ttol in SNESKSPEW_PreSolve()</div>
<div>are allowed, what should take its place?</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> More generally, should this sort of thing be handled everywhere using<br>
> snes->norm_init for consistency and to prevent potential breakage?<br>
<br>
</div>snes->norm_init goes with SNESSetInitialFunctionNorm and I don't think<br>
it's used otherwise.<br></blockquote><div>I was just thinking of a single cache for the initial residual norm.</div><div>Currently there are at least two, it seems to me.</div><div><br></div><div>Dmitry.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
> At the very least, should snes->ttol = ... be removed from<br>
> SNESConvergedDefault()?<br>
<br>
<br>
<br>
> Thanks.<br>
> Dmitry.<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div><br>
</div></div>