<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body dir="auto">
<span style="background-color: rgba(255, 255, 255, 0);">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?</span>
<div><br>
</div>
<div>Hong<br>
<div dir="ltr"><br>
On Oct 4, 2019, at 5:39 AM, Lisandro Dalcin via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br>
<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">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)?
<div><br>
</div>
<div>Could you run a couple TS steps with a small problem under valgrind?</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Fri, 4 Oct 2019 at 02:51, Mark Lohry <<a href="mailto:mlohry@gmail.com">mlohry@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>Hi Lisandro, output pasted below.<br>
</div>
<div><br>
</div>
<div> TSAdapt none bdf 0:2 step 11692 accepted t=35.0025 + 3.000e-03 dt=3.000e-03
</div>
11693 TS dt 0.003 time 35.0055<br>
0 SNES Function norm 4.012644977146e+05 <br>
[0] SNESComputeJacobian(): Reusing Jacobian/preconditioner because lag is 10000 and SNES iteration is 0<br>
0 KSP Residual norm 4.012644977146e+05 <br>
1 KSP Residual norm 6.887905652252e+04 <br>
2 KSP Residual norm 1.529385383204e+04 <br>
3 KSP Residual norm 2.962734714586e+03 <br>
4 KSP Residual norm 8.159925296953e+02 <br>
5 KSP Residual norm 2.621494425025e+02 <br>
6 KSP Residual norm 8.621533983121e+01 <br>
7 KSP Residual norm 3.454115520510e+01 <br>
Linear solve converged due to CONVERGED_RTOL iterations 7<br>
[0] SNESSolve_NEWTONLS(): iter=0, linear solve iterations=7<br>
[0] SNESLineSearchApply_BT(): Initial fnorm 4.012644977146e+05 gnorm 8.258167145633e+02<br>
Line search: Using full step: fnorm 4.012644977146e+05 gnorm 8.258167145633e+02<br>
[0] SNESSolve_NEWTONLS(): fnorm=4.0126449771463231e+05, gnorm=8.2581671456329491e+02, ynorm=4.5449068874732134e+01, lssucceed=0<br>
1 SNES Function norm 8.258167145633e+02 <br>
[0] SNESComputeJacobian(): Reusing Jacobian/preconditioner because lag is 10000 and SNES iteration is 1<br>
0 KSP Residual norm 8.258167145633e+02 <br>
1 KSP Residual norm 2.368970771299e+02 <br>
2 KSP Residual norm 4.926151111673e+01 <br>
3 KSP Residual norm 1.109318372023e+01 <br>
4 KSP Residual norm 4.206838530700e+00 <br>
5 KSP Residual norm 1.706918092245e+00 <br>
6 KSP Residual norm 7.492966479103e-01 <br>
7 KSP Residual norm 2.714577929568e-01 <br>
8 KSP Residual norm 9.807997907160e-02 <br>
9 KSP Residual norm 3.710990495688e-02 <br>
Linear solve converged due to CONVERGED_RTOL iterations 9<br>
[0] SNESSolve_NEWTONLS(): iter=1, linear solve iterations=9<br>
[0] SNESLineSearchApply_BT(): Initial fnorm 8.258167145633e+02 gnorm 8.356227256317e-02<br>
Line search: Using full step: fnorm 8.258167145633e+02 gnorm 8.356227256317e-02<br>
[0] SNESSolve_NEWTONLS(): fnorm=8.2581671456329491e+02, gnorm=8.3562272563172696e-02, ynorm=1.7925733424255871e-01, lssucceed=0<br>
2 SNES Function norm 8.356227256317e-02 <br>
[0] SNESConvergedDefault(): Converged due to function norm 8.356227256317e-02 < 4.012644977146e+02 (relative tolerance)<br>
Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 2<br>
0 SNES Function norm 3.899041382640e+05 <br>
<div>[0] SNESComputeJacobian(): Reusing Jacobian/preconditioner because lag is 10000 and SNES iteration is 0</div>
<div> 0 KSP Residual norm 3.899041382640e+05 <br>
1 KSP Residual norm 6.379578129836e+04 <br>
2 KSP Residual norm 1.343873551860e+04 <br>
3 KSP Residual norm 2.476721698174e+03 <br>
4 KSP Residual norm 5.720534698320e+02 <br>
5 KSP Residual norm 1.363347982835e+02 <br>
6 KSP Residual norm 4.018758314613e+01 <br>
7 KSP Residual norm 1.469768890242e+01 <br>
Linear solve converged due to CONVERGED_RTOL iterations 7<br>
[0] SNESSolve_NEWTONLS(): iter=0, linear solve iterations=7<br>
[0] SNESLineSearchApply_BT(): Initial fnorm 3.899041382640e+05 gnorm 7.167873070683e+02<br>
Line search: Using full step: fnorm 3.899041382640e+05 gnorm 7.167873070683e+02<br>
[0] SNESSolve_NEWTONLS(): fnorm=3.8990413826397544e+05, gnorm=7.1678730706831891e+02, ynorm=4.6048127294939860e+01, lssucceed=0<br>
1 SNES Function norm 7.167873070683e+02 <br>
[0] SNESComputeJacobian(): Reusing Jacobian/preconditioner because lag is 10000 and SNES iteration is 1<br>
0 KSP Residual norm 7.167873070683e+02 <br>
1 KSP Residual norm 1.926436040254e+02 <br>
2 KSP Residual norm 3.814513636810e+01 <br>
3 KSP Residual norm 7.279530183085e+00 <br>
4 KSP Residual norm 1.853552262748e+00 <br>
5 KSP Residual norm 7.407362901528e-01 <br>
6 KSP Residual norm 2.803020992519e-01 <br>
7 KSP Residual norm 8.321822325164e-02 <br>
8 KSP Residual norm 2.341071572765e-02 <br>
Linear solve converged due to CONVERGED_RTOL iterations 8<br>
[0] SNESSolve_NEWTONLS(): iter=1, linear solve iterations=8<br>
[0] SNESLineSearchApply_BT(): Initial fnorm 7.167873070683e+02 gnorm 6.352818740653e-02<br>
Line search: Using full step: fnorm 7.167873070683e+02 gnorm 6.352818740653e-02<br>
[0] SNESSolve_NEWTONLS(): fnorm=7.1678730706831891e+02, gnorm=6.3528187406533682e-02, ynorm=9.3278464688271612e-02, lssucceed=0<br>
2 SNES Function norm 6.352818740653e-02 <br>
[0] SNESConvergedDefault(): Converged due to function norm 6.352818740653e-02 < 3.899041382640e+02 (relative tolerance)<br>
Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 2<br>
TSAdapt none bdf 0:2 step 11693 accepted t=35.0055 + 3.000e-03 dt=3.000e-03
<br>
</div>
<div><br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Oct 3, 2019 at 3:24 AM Lisandro Dalcin <<a href="mailto:dalcinl@gmail.com" target="_blank">dalcinl@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">Could you please run adding the following options?: -info -info_exclude null,vec,mat,pc,ksp<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, 3 Oct 2019 at 00:18, Mark Lohry via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div>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.</div>
<div><br>
</div>
<div>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?<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div> TSAdapt none bdf 0:2 step 4338 accepted t=12.9405 + 3.000e-03 dt=3.000e-03
<br>
4339 TS dt 0.003 time 12.9435<br>
0 SNES Function norm 4.226055465790e+05 <br>
0 KSP Residual norm 4.226055465790e+05 <br>
1 KSP Residual norm 7.217261332498e+04 <br>
2 KSP Residual norm 1.716940034507e+04 <br>
3 KSP Residual norm 3.609973232253e+03 <br>
4 KSP Residual norm 9.570019108717e+02 <br>
5 KSP Residual norm 3.181149723450e+02 <br>
6 KSP Residual norm 1.098208407227e+02 <br>
7 KSP Residual norm 4.299901363380e+01 <br>
8 KSP Residual norm 1.801536459692e+01 <br>
Linear solve converged due to CONVERGED_RTOL iterations 8<br>
Line search: Using full step: fnorm 4.226055465790e+05 gnorm 9.086241923538e+02<br>
1 SNES Function norm 9.086241923538e+02 <br>
0 KSP Residual norm 9.086241923538e+02 <br>
1 KSP Residual norm 2.732368360068e+02 <br>
2 KSP Residual norm 5.946263156564e+01 <br>
3 KSP Residual norm 1.318454641577e+01 <br>
4 KSP Residual norm 4.246879230104e+00 <br>
5 KSP Residual norm 1.629532917180e+00 <br>
6 KSP Residual norm 7.256484455948e-01 <br>
7 KSP Residual norm 2.902145678910e-01 <br>
8 KSP Residual norm 1.057108012071e-01 <br>
9 KSP Residual norm 3.932046314157e-02 <br>
Linear solve converged due to CONVERGED_RTOL iterations 9<br>
Line search: Using full step: fnorm 9.086241923538e+02 gnorm 1.085625777754e-01<br>
2 SNES Function norm 1.085625777754e-01 <br>
Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 2</div>
<div> 0 SNES Function norm 4.118788489827e+05 <br>
0 KSP Residual norm 4.118788489827e+05 <br>
1 KSP Residual norm 6.711617192535e+04 <br>
2 KSP Residual norm 1.492314271439e+04 <br>
3 KSP Residual norm 3.057857706767e+03 <br>
4 KSP Residual norm 7.126664078732e+02 <br>
5 KSP Residual norm 1.733711813386e+02 <br>
6 KSP Residual norm 5.128037920544e+01 <br>
7 KSP Residual norm 1.934133099773e+01 <br>
Linear solve converged due to CONVERGED_RTOL iterations 7<br>
Line search: Using full step: fnorm 4.118788489827e+05 gnorm 8.042808436078e+02<br>
1 SNES Function norm 8.042808436078e+02 <br>
0 KSP Residual norm 8.042808436078e+02 <br>
1 KSP Residual norm 2.226749543958e+02 <br>
2 KSP Residual norm 4.893662950348e+01 <br>
3 KSP Residual norm 1.014517695941e+01 <br>
4 KSP Residual norm 2.919647780049e+00 <br>
5 KSP Residual norm 1.212767990171e+00 <br>
6 KSP Residual norm 4.595747459796e-01 <br>
7 KSP Residual norm 1.380287337736e-01 <br>
8 KSP Residual norm 3.905014995608e-02 <br>
Linear solve converged due to CONVERGED_RTOL iterations 8<br>
Line search: Using full step: fnorm 8.042808436078e+02 gnorm 9.400756998055e-02<br>
2 SNES Function norm 9.400756998055e-02 <br>
Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 2<br>
TSAdapt none bdf 0:2 step 4339 accepted t=12.9435 + 3.000e-03 dt=3.000e-03
<br>
4340 TS dt 0.003 time 12.9465</div>
<div> 0 SNES Function norm 4.225721444289e+05 <br>
0 KSP Residual norm 4.225721444289e+05 <br>
1 KSP Residual norm 7.216809879956e+04 <br>
2 KSP Residual norm 1.716800266656e+04 <br>
3 KSP Residual norm 3.609544652142e+03 <br>
4 KSP Residual norm 9.568035630128e+02 <br>
5 KSP Residual norm 3.180994491726e+02 <br>
6 KSP Residual norm 1.097953544519e+02 <br>
7 KSP Residual norm 4.299356909365e+01 <br>
8 KSP Residual norm 1.801685954142e+01 <br>
Linear solve converged due to CONVERGED_RTOL iterations 8<br>
Line search: Using full step: fnorm 4.225721444289e+05 gnorm 9.085909169586e+02<br>
1 SNES Function norm 9.085909169586e+02 <br>
0 KSP Residual norm 9.085909169586e+02 <br>
1 KSP Residual norm 2.732217555260e+02 <br>
2 KSP Residual norm 5.946115359458e+01 <br>
3 KSP Residual norm 1.318376336422e+01 <br>
4 KSP Residual norm 4.246505956377e+00 <br>
5 KSP Residual norm 1.629395330390e+00 <br>
6 KSP Residual norm 7.256387857307e-01 <br>
7 KSP Residual norm 2.902187369698e-01 <br>
8 KSP Residual norm 1.057339888296e-01 <br>
9 KSP Residual norm 3.933238584494e-02 <br>
Linear solve converged due to CONVERGED_RTOL iterations 9<br>
Line search: Using full step: fnorm 9.085909169586e+02 gnorm 1.080918043129e-01<br>
2 SNES Function norm 1.080918043129e-01 <br>
Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 2<br>
0 SNES Function norm 4.118496718810e+05 <br>
0 KSP Residual norm 4.118496718810e+05 <br>
1 KSP Residual norm 6.711314158688e+04 <br>
2 KSP Residual norm 1.492217651739e+04 <br>
3 KSP Residual norm 3.057646684123e+03 <br>
4 KSP Residual norm 7.125472187771e+02 <br>
5 KSP Residual norm 1.733587575824e+02 <br>
6 KSP Residual norm 5.128167491875e+01 <br>
7 KSP Residual norm 1.934091783097e+01 <br>
Linear solve converged due to CONVERGED_RTOL iterations 7<br>
Line search: Using full step: fnorm 4.118496718810e+05 gnorm 8.042975384362e+02<br>
1 SNES Function norm 8.042975384362e+02 <br>
0 KSP Residual norm 8.042975384362e+02 <br>
1 KSP Residual norm 2.226789925199e+02 <br>
2 KSP Residual norm 4.893747432913e+01 <br>
3 KSP Residual norm 1.014667103302e+01 <br>
4 KSP Residual norm 2.920119822095e+00 <br>
5 KSP Residual norm 1.213085518447e+00 <br>
6 KSP Residual norm 4.596447482282e-01 <br>
7 KSP Residual norm 1.380197971941e-01 <br>
8 KSP Residual norm 3.903724744383e-02 <br>
Linear solve converged due to CONVERGED_RTOL iterations 8<br>
Line search: Using full step: fnorm 8.042975384362e+02 gnorm 9.401994558838e-02<br>
2 SNES Function norm 9.401994558838e-02 <br>
Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 2<br>
TSAdapt none bdf 0:2 step 4340 accepted t=12.9465 + 3.000e-03 dt=3.000e-03
</div>
<br>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<div dir="ltr">
<div>Lisandro Dalcin<br>
============<br>
Research Scientist<br>
Extreme Computing Research Center (ECRC)<br>
King Abdullah University of Science and Technology (KAUST)<br>
<a href="http://ecrc.kaust.edu.sa/" target="_blank">http://ecrc.kaust.edu.sa/</a><br>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>Lisandro Dalcin<br>
============<br>
Research Scientist<br>
Extreme Computing Research Center (ECRC)<br>
King Abdullah University of Science and Technology (KAUST)<br>
<a href="http://ecrc.kaust.edu.sa/" target="_blank">http://ecrc.kaust.edu.sa/</a><br>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</body>
</html>