[petsc-users] BDF2 using two SNES solves per step

Zhang, Hong hongzhang at anl.gov
Sun Oct 6 00:03:18 CDT 2019


Crank-Nicolson does one SNES solve per step. If you see two using CN, then it is not likely a problem with BDF specifically. Did you have any explicit call to SNESSolve() in the code?

Hong

On Oct 4, 2019, at 5:39 AM, Lisandro Dalcin via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:

I'm not sure what's going on. Could you please paste the full command line (or at least all the relevant ts,snes,ksp,pc options)?

Could you run a  couple TS steps with a small problem under valgrind?


On Fri, 4 Oct 2019 at 02:51, Mark Lohry <mlohry at gmail.com<mailto:mlohry at gmail.com>> wrote:
Hi Lisandro, output pasted below.

      TSAdapt none bdf 0:2 step 11692 accepted t=35.0025    + 3.000e-03 dt=3.000e-03
11693 TS dt 0.003 time 35.0055
    0 SNES Function norm 4.012644977146e+05
[0] SNESComputeJacobian(): Reusing Jacobian/preconditioner because lag is 10000 and SNES iteration is 0
      0 KSP Residual norm 4.012644977146e+05
      1 KSP Residual norm 6.887905652252e+04
      2 KSP Residual norm 1.529385383204e+04
      3 KSP Residual norm 2.962734714586e+03
      4 KSP Residual norm 8.159925296953e+02
      5 KSP Residual norm 2.621494425025e+02
      6 KSP Residual norm 8.621533983121e+01
      7 KSP Residual norm 3.454115520510e+01
    Linear solve converged due to CONVERGED_RTOL iterations 7
[0] SNESSolve_NEWTONLS(): iter=0, linear solve iterations=7
[0] SNESLineSearchApply_BT(): Initial fnorm 4.012644977146e+05 gnorm 8.258167145633e+02
        Line search: Using full step: fnorm 4.012644977146e+05 gnorm 8.258167145633e+02
[0] SNESSolve_NEWTONLS(): fnorm=4.0126449771463231e+05, gnorm=8.2581671456329491e+02, ynorm=4.5449068874732134e+01, lssucceed=0
    1 SNES Function norm 8.258167145633e+02
[0] SNESComputeJacobian(): Reusing Jacobian/preconditioner because lag is 10000 and SNES iteration is 1
      0 KSP Residual norm 8.258167145633e+02
      1 KSP Residual norm 2.368970771299e+02
      2 KSP Residual norm 4.926151111673e+01
      3 KSP Residual norm 1.109318372023e+01
      4 KSP Residual norm 4.206838530700e+00
      5 KSP Residual norm 1.706918092245e+00
      6 KSP Residual norm 7.492966479103e-01
      7 KSP Residual norm 2.714577929568e-01
      8 KSP Residual norm 9.807997907160e-02
      9 KSP Residual norm 3.710990495688e-02
    Linear solve converged due to CONVERGED_RTOL iterations 9
[0] SNESSolve_NEWTONLS(): iter=1, linear solve iterations=9
[0] SNESLineSearchApply_BT(): Initial fnorm 8.258167145633e+02 gnorm 8.356227256317e-02
        Line search: Using full step: fnorm 8.258167145633e+02 gnorm 8.356227256317e-02
[0] SNESSolve_NEWTONLS(): fnorm=8.2581671456329491e+02, gnorm=8.3562272563172696e-02, ynorm=1.7925733424255871e-01, lssucceed=0
    2 SNES Function norm 8.356227256317e-02
[0] SNESConvergedDefault(): Converged due to function norm 8.356227256317e-02 < 4.012644977146e+02 (relative tolerance)
  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 2
    0 SNES Function norm 3.899041382640e+05
[0] SNESComputeJacobian(): Reusing Jacobian/preconditioner because lag is 10000 and SNES iteration is 0
      0 KSP Residual norm 3.899041382640e+05
      1 KSP Residual norm 6.379578129836e+04
      2 KSP Residual norm 1.343873551860e+04
      3 KSP Residual norm 2.476721698174e+03
      4 KSP Residual norm 5.720534698320e+02
      5 KSP Residual norm 1.363347982835e+02
      6 KSP Residual norm 4.018758314613e+01
      7 KSP Residual norm 1.469768890242e+01
    Linear solve converged due to CONVERGED_RTOL iterations 7
[0] SNESSolve_NEWTONLS(): iter=0, linear solve iterations=7
[0] SNESLineSearchApply_BT(): Initial fnorm 3.899041382640e+05 gnorm 7.167873070683e+02
        Line search: Using full step: fnorm 3.899041382640e+05 gnorm 7.167873070683e+02
[0] SNESSolve_NEWTONLS(): fnorm=3.8990413826397544e+05, gnorm=7.1678730706831891e+02, ynorm=4.6048127294939860e+01, lssucceed=0
    1 SNES Function norm 7.167873070683e+02
[0] SNESComputeJacobian(): Reusing Jacobian/preconditioner because lag is 10000 and SNES iteration is 1
      0 KSP Residual norm 7.167873070683e+02
      1 KSP Residual norm 1.926436040254e+02
      2 KSP Residual norm 3.814513636810e+01
      3 KSP Residual norm 7.279530183085e+00
      4 KSP Residual norm 1.853552262748e+00
      5 KSP Residual norm 7.407362901528e-01
      6 KSP Residual norm 2.803020992519e-01
      7 KSP Residual norm 8.321822325164e-02
      8 KSP Residual norm 2.341071572765e-02
    Linear solve converged due to CONVERGED_RTOL iterations 8
[0] SNESSolve_NEWTONLS(): iter=1, linear solve iterations=8
[0] SNESLineSearchApply_BT(): Initial fnorm 7.167873070683e+02 gnorm 6.352818740653e-02
        Line search: Using full step: fnorm 7.167873070683e+02 gnorm 6.352818740653e-02
[0] SNESSolve_NEWTONLS(): fnorm=7.1678730706831891e+02, gnorm=6.3528187406533682e-02, ynorm=9.3278464688271612e-02, lssucceed=0
    2 SNES Function norm 6.352818740653e-02
[0] SNESConvergedDefault(): Converged due to function norm 6.352818740653e-02 < 3.899041382640e+02 (relative tolerance)
  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 2
      TSAdapt none bdf 0:2 step 11693 accepted t=35.0055    + 3.000e-03 dt=3.000e-03


On Thu, Oct 3, 2019 at 3:24 AM Lisandro Dalcin <dalcinl at gmail.com<mailto:dalcinl at gmail.com>> wrote:
Could you please run adding the following options?:  -info -info_exclude null,vec,mat,pc,ksp

On Thu, 3 Oct 2019 at 00:18, Mark Lohry via petsc-users <petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>> wrote:
I've been using -ts_type bdf for some cases, and I'm seeing odd behavior I haven't seen previously; BDF is doing two nonlinear solves per step instead of one. Not just on the first iteration where I understand it needs two solves to do crank-nicolson. Output pasted below.

I recently added -snes_force_iteration to this setup because some related cases were hitting the STOL tolerance too easily and skipping the step. Possible there's a bug here?



      TSAdapt none bdf 0:2 step 4338 accepted t=12.9405    + 3.000e-03 dt=3.000e-03
4339 TS dt 0.003 time 12.9435
    0 SNES Function norm 4.226055465790e+05
      0 KSP Residual norm 4.226055465790e+05
      1 KSP Residual norm 7.217261332498e+04
      2 KSP Residual norm 1.716940034507e+04
      3 KSP Residual norm 3.609973232253e+03
      4 KSP Residual norm 9.570019108717e+02
      5 KSP Residual norm 3.181149723450e+02
      6 KSP Residual norm 1.098208407227e+02
      7 KSP Residual norm 4.299901363380e+01
      8 KSP Residual norm 1.801536459692e+01
    Linear solve converged due to CONVERGED_RTOL iterations 8
        Line search: Using full step: fnorm 4.226055465790e+05 gnorm 9.086241923538e+02
    1 SNES Function norm 9.086241923538e+02
      0 KSP Residual norm 9.086241923538e+02
      1 KSP Residual norm 2.732368360068e+02
      2 KSP Residual norm 5.946263156564e+01
      3 KSP Residual norm 1.318454641577e+01
      4 KSP Residual norm 4.246879230104e+00
      5 KSP Residual norm 1.629532917180e+00
      6 KSP Residual norm 7.256484455948e-01
      7 KSP Residual norm 2.902145678910e-01
      8 KSP Residual norm 1.057108012071e-01
      9 KSP Residual norm 3.932046314157e-02
    Linear solve converged due to CONVERGED_RTOL iterations 9
        Line search: Using full step: fnorm 9.086241923538e+02 gnorm 1.085625777754e-01
    2 SNES Function norm 1.085625777754e-01
  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 2
    0 SNES Function norm 4.118788489827e+05
      0 KSP Residual norm 4.118788489827e+05
      1 KSP Residual norm 6.711617192535e+04
      2 KSP Residual norm 1.492314271439e+04
      3 KSP Residual norm 3.057857706767e+03
      4 KSP Residual norm 7.126664078732e+02
      5 KSP Residual norm 1.733711813386e+02
      6 KSP Residual norm 5.128037920544e+01
      7 KSP Residual norm 1.934133099773e+01
    Linear solve converged due to CONVERGED_RTOL iterations 7
        Line search: Using full step: fnorm 4.118788489827e+05 gnorm 8.042808436078e+02
    1 SNES Function norm 8.042808436078e+02
      0 KSP Residual norm 8.042808436078e+02
      1 KSP Residual norm 2.226749543958e+02
      2 KSP Residual norm 4.893662950348e+01
      3 KSP Residual norm 1.014517695941e+01
      4 KSP Residual norm 2.919647780049e+00
      5 KSP Residual norm 1.212767990171e+00
      6 KSP Residual norm 4.595747459796e-01
      7 KSP Residual norm 1.380287337736e-01
      8 KSP Residual norm 3.905014995608e-02
    Linear solve converged due to CONVERGED_RTOL iterations 8
        Line search: Using full step: fnorm 8.042808436078e+02 gnorm 9.400756998055e-02
    2 SNES Function norm 9.400756998055e-02
  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 2
      TSAdapt none bdf 0:2 step 4339 accepted t=12.9435    + 3.000e-03 dt=3.000e-03
4340 TS dt 0.003 time 12.9465
    0 SNES Function norm 4.225721444289e+05
      0 KSP Residual norm 4.225721444289e+05
      1 KSP Residual norm 7.216809879956e+04
      2 KSP Residual norm 1.716800266656e+04
      3 KSP Residual norm 3.609544652142e+03
      4 KSP Residual norm 9.568035630128e+02
      5 KSP Residual norm 3.180994491726e+02
      6 KSP Residual norm 1.097953544519e+02
      7 KSP Residual norm 4.299356909365e+01
      8 KSP Residual norm 1.801685954142e+01
    Linear solve converged due to CONVERGED_RTOL iterations 8
        Line search: Using full step: fnorm 4.225721444289e+05 gnorm 9.085909169586e+02
    1 SNES Function norm 9.085909169586e+02
      0 KSP Residual norm 9.085909169586e+02
      1 KSP Residual norm 2.732217555260e+02
      2 KSP Residual norm 5.946115359458e+01
      3 KSP Residual norm 1.318376336422e+01
      4 KSP Residual norm 4.246505956377e+00
      5 KSP Residual norm 1.629395330390e+00
      6 KSP Residual norm 7.256387857307e-01
      7 KSP Residual norm 2.902187369698e-01
      8 KSP Residual norm 1.057339888296e-01
      9 KSP Residual norm 3.933238584494e-02
    Linear solve converged due to CONVERGED_RTOL iterations 9
        Line search: Using full step: fnorm 9.085909169586e+02 gnorm 1.080918043129e-01
    2 SNES Function norm 1.080918043129e-01
  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 2
    0 SNES Function norm 4.118496718810e+05
      0 KSP Residual norm 4.118496718810e+05
      1 KSP Residual norm 6.711314158688e+04
      2 KSP Residual norm 1.492217651739e+04
      3 KSP Residual norm 3.057646684123e+03
      4 KSP Residual norm 7.125472187771e+02
      5 KSP Residual norm 1.733587575824e+02
      6 KSP Residual norm 5.128167491875e+01
      7 KSP Residual norm 1.934091783097e+01
    Linear solve converged due to CONVERGED_RTOL iterations 7
        Line search: Using full step: fnorm 4.118496718810e+05 gnorm 8.042975384362e+02
    1 SNES Function norm 8.042975384362e+02
      0 KSP Residual norm 8.042975384362e+02
      1 KSP Residual norm 2.226789925199e+02
      2 KSP Residual norm 4.893747432913e+01
      3 KSP Residual norm 1.014667103302e+01
      4 KSP Residual norm 2.920119822095e+00
      5 KSP Residual norm 1.213085518447e+00
      6 KSP Residual norm 4.596447482282e-01
      7 KSP Residual norm 1.380197971941e-01
      8 KSP Residual norm 3.903724744383e-02
    Linear solve converged due to CONVERGED_RTOL iterations 8
        Line search: Using full step: fnorm 8.042975384362e+02 gnorm 9.401994558838e-02
    2 SNES Function norm 9.401994558838e-02
  Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 2
      TSAdapt none bdf 0:2 step 4340 accepted t=12.9465    + 3.000e-03 dt=3.000e-03



--
Lisandro Dalcin
============
Research Scientist
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)
http://ecrc.kaust.edu.sa/


--
Lisandro Dalcin
============
Research Scientist
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)
http://ecrc.kaust.edu.sa/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20191006/5a63d0f4/attachment-0001.html>


More information about the petsc-users mailing list