[petsc-users] snes parameter suggestions

Matthew Knepley knepley at gmail.com
Thu Mar 30 19:46:29 CDT 2017


On Thu, Mar 30, 2017 at 7:09 PM, Gideon Simpson <gideon.simpson at gmail.com>
wrote:

> About a month ago, I mentioned that I was trying to set up a projected
> integration scheme within petsc, where I use a classical integrator (i.e.,
> RK4), at each time step, and then correct my prediction dependent variable,
> yp, by solving a nonlinear equation g(y + lambda * f(yp)) =0 for a scalar
> parameter lambda.  Out of stubbornness, I did this entirely within the
> confines of petsc, using a SNES.  Following up on a comment of Barry’s,
> about the solver taking an excessive number of function evaluations, I
> realized that, in fact, the SNES was failing to converge (algorithmically),
> even though it was giving reasonable answers.  In particular, I see output
> like what is displayed below.
>
> I am using the default snes/ksp solvers with default tolerances.  It would
> seem to me that I should have been quite happy after 1 SNES iteration,
> given that this is a scalar problem.  This can obviously be done by setting
> the atol to something like 1e-12, but I was curious if people had other
> thoughts on this.
>

I think its possible that your Jacobian is not accurate enough to converge
below 1e-13, or that your residual evaluation
is no longer accurate below that. I would set the atol as you suggest.

   Matt


>   0 SNES Function norm 5.142950291311e-10
>     0 KSP Residual norm 6.057087103783e-11
>     1 KSP Residual norm 1.681179391195e-26
>       Line search: Using full step: fnorm 5.142950291311e-10 gnorm
> 5.783398860650e-14
>   1 SNES Function norm 5.783398860650e-14
>     0 KSP Residual norm 5.520053977167e-15
>     1 KSP Residual norm 1.370372252609e-30
>       Line search: gnorm after quadratic fit 5.728578676879e-14
>       Line search: Quadratically determined step,
> lambda=3.9611360239162957e-01
>   2 SNES Function norm 5.728578676879e-14
>     0 KSP Residual norm 5.024285935857e-15
>     1 KSP Residual norm 2.789038964144e-31
>       Line search: gnorm after quadratic fit 4.278033777465e-14
>       Line search: Quadratically determined step,
> lambda=2.4691358024691357e-01
>   3 SNES Function norm 4.278033777465e-14
>     0 KSP Residual norm 3.520343148370e-15
>     1 KSP Residual norm 5.527264229234e-31
>       Line search: gnorm after quadratic fit 2.842170943040e-14
>       Line search: Quadratically determined step,
> lambda=2.5438596491228038e-01
>   4 SNES Function norm 2.842170943040e-14
>     0 KSP Residual norm 2.016428211944e-15
>     1 KSP Residual norm 2.238685028403e-31
>       Line search: gnorm after quadratic fit 5.695433295430e-14
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 4.278033777465e-14 lambda=1.0000000000000002e-02
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=1.0000000000000002e-03
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=5.0000000000000012e-04
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=2.1132486540518717e-04
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=9.2196144189362134e-05
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=4.0004514620095227e-05
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=1.7374756353482527e-05
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=7.5449506476837614e-06
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=3.2764733594125655e-06
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=1.4228354923470249e-06
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=6.1787855254724169e-07
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=2.6831903567985152e-07
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=1.1651983473611860e-07
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=5.0599733967314922e-08
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=2.1973366898757625e-08
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=9.5421223580158174e-09
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=4.1437481801087470e-09
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=1.7994580593128418e-09
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=7.8143004026450871e-10
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=3.3934267301617141e-10
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=1.4736245574944127e-10
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=6.3993405755577026e-11
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=2.7789683331288042e-11
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=1.2067907474762995e-11
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=5.2405919521750200e-12
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=2.2757718408626572e-12
>       Line search: Cubic step no good, shrinking lambda, current gnorm
> 2.842170943040e-14 lambda=9.8827337043745462e-13
>       Line search: unable to find good step length! After 27 tries
>       Line search: fnorm=2.8421709430404007e-14,
> gnorm=2.8421709430404007e-14, ynorm=2.0164282119435693e-15,
> minlambda=9.9999999999999998e-13, lambda=9.8827337043745462e-13, initial
> slope=-8.0779356694631465e-28
>
>
>
> -gideon
>
>


-- 
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/20170330/009a5a24/attachment-0001.html>


More information about the petsc-users mailing list