<div dir="ltr">I checked out branch <a href="https://bitbucket.org/petsc/petsc/branch/barry/fix-huge-flaw-in-ts" style="color:rgb(53,114,176);font-family:arial,sans-serif;font-size:14px">barry/fix-huge-flaw-in-ts</a> (see pull request #655) and reconfigured and rebuilt.<div><br></div><div>No, the ts/.../ex2.c example is not fixed.  It gives same error:</div><div><br></div><div><div>~/petsc/src/ts/examples/tutorials[barry/fix-huge-flaw-in-ts*]$ ./ex2 -ts_dt 0.001 -ts_final_time 0.001 -snes_monitor -snes_mf_operator</div><div>    0 SNES Function norm 1.059316422854e+01 </div><div>[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------</div><div>[0]PETSC ERROR: No support for this operation for this object type</div><div>[0]PETSC ERROR: Mat type mffd</div><div>[0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.</div><div>[0]PETSC ERROR: Petsc Development GIT revision: v3.7.5-3346-g41a1d4d  GIT Date: 2017-03-24 14:39:28 -0500</div><div>[0]PETSC ERROR: ./ex2 on a linux-c-dbg named bueler-leopard by ed Sun Apr  2 18:31:55 2017</div><div>[0]PETSC ERROR: Configure options --download-mpich --with-debugging=1</div><div>[0]PETSC ERROR: #1 MatZeroEntries() line 5471 in /home/ed/petsc/src/mat/interface/matrix.c</div><div>[0]PETSC ERROR: #2 TSComputeIJacobian() line 942 in /home/ed/petsc/src/ts/interface/ts.c</div><div>[0]PETSC ERROR: #3 SNESTSFormJacobian_Theta() line 515 in /home/ed/petsc/src/ts/impls/implicit/theta/theta.c</div><div>[0]PETSC ERROR: #4 SNESTSFormJacobian() line 5055 in /home/ed/petsc/src/ts/interface/ts.c</div><div>[0]PETSC ERROR: #5 SNESComputeJacobian() line 2276 in /home/ed/petsc/src/snes/interface/snes.c</div><div>[0]PETSC ERROR: #6 SNESSolve_NEWTONLS() line 222 in /home/ed/petsc/src/snes/impls/ls/ls.c</div><div>[0]PETSC ERROR: #7 SNESSolve() line 3967 in /home/ed/petsc/src/snes/interface/snes.c</div><div>[0]PETSC ERROR: #8 TS_SNESSolve() line 171 in /home/ed/petsc/src/ts/impls/implicit/theta/theta.c</div><div>[0]PETSC ERROR: #9 TSStep_Theta() line 211 in /home/ed/petsc/src/ts/impls/implicit/theta/theta.c</div><div>[0]PETSC ERROR: #10 TSStep() line 3820 in /home/ed/petsc/src/ts/interface/ts.c</div><div>[0]PETSC ERROR: #11 TSSolve() line 4065 in /home/ed/petsc/src/ts/interface/ts.c</div><div>[0]PETSC ERROR: #12 main() line 194 in /home/ed/petsc/src/ts/examples/tutorials/ex2.c</div><div>[0]PETSC ERROR: PETSc Option Table entries:</div><div>[0]PETSC ERROR: -snes_mf_operator</div><div>[0]PETSC ERROR: -snes_monitor</div><div>[0]PETSC ERROR: -ts_dt 0.001</div><div>[0]PETSC ERROR: -ts_final_time 0.001</div><div>[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------</div><div>application called MPI_Abort(MPI_COMM_WORLD, 56) - process 0</div><div>[unset]: aborting job:</div><div>application called MPI_Abort(MPI_COMM_WORLD, 56) - process 0</div></div><div><br></div><div>Curiously, my own code (attached), which differs from ex2.c in that it uses DMDA, *does* change behavior to a DIVERGED_NONLINEAR_SOLVE error:</div><div><br></div><div><div>$ ./advect -da_refine 0 -ts_monitor -adv_circlewind -adv_conex 0.3 -adv_coney 0.3 -ts_type beuler -snes_monitor_short -ts_final_time 0.01 -ts_dt 0.01 -snes_rtol 1.0e-4 -adv_firstorder -snes_mf_operator</div><div>solving on 5 x 5 grid with dx=0.2 x dy=0.2 cells, t0=0.,</div><div>and initial step dt=0.01 ...</div><div>0 TS dt 0.01 time 0.</div><div>    0 SNES Function norm 2.1277 </div><div>[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------</div><div>[0]PETSC ERROR:   </div><div>[0]PETSC ERROR: TSStep has failed due to DIVERGED_NONLINEAR_SOLVE, increase -ts_max_snes_failures or make negative to attempt recovery</div><div>[0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html">http://www.mcs.anl.gov/petsc/documentation/faq.html</a> for trouble shooting.</div><div>[0]PETSC ERROR: Petsc Development GIT revision: v3.7.5-3346-g41a1d4d  GIT Date: 2017-03-24 14:39:28 -0500</div><div>[0]PETSC ERROR: ./advect on a linux-c-dbg named bueler-leopard by ed Sun Apr  2 18:34:18 2017</div><div>[0]PETSC ERROR: Configure options --download-mpich --with-debugging=1</div><div>[0]PETSC ERROR: #1 TSStep() line 3829 in /home/ed/petsc/src/ts/interface/ts.c</div><div>[0]PETSC ERROR: #2 TSSolve() line 4065 in /home/ed/petsc/src/ts/interface/ts.c</div><div>[0]PETSC ERROR: #3 main() line 314 in /home/ed/repos/p4pdes/c/ch9/advect.c</div><div>[0]PETSC ERROR: PETSc Option Table entries:</div><div>[0]PETSC ERROR: -adv_circlewind</div><div>[0]PETSC ERROR: -adv_conex 0.3</div><div>[0]PETSC ERROR: -adv_coney 0.3</div><div>[0]PETSC ERROR: -adv_firstorder</div><div>[0]PETSC ERROR: -da_refine 0</div><div>[0]PETSC ERROR: -snes_mf_operator</div><div>[0]PETSC ERROR: -snes_monitor_short</div><div>[0]PETSC ERROR: -snes_rtol 1.0e-4</div><div>[0]PETSC ERROR: -ts_dt 0.01</div><div>[0]PETSC ERROR: -ts_final_time 0.01</div><div>[0]PETSC ERROR: -ts_monitor</div><div>[0]PETSC ERROR: -ts_type beuler</div><div>[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------</div><div>application called MPI_Abort(MPI_COMM_WORLD, 91) - process 0</div><div>[unset]: aborting job:</div><div>application called MPI_Abort(MPI_COMM_WORLD, 91) - process 0</div></div><div><br></div><div>Previously it gave a "No support for this operation for this object type ... Mat type mffd" error like ex2.c.  Progress?</div><div><br></div><div>Note that my code works fine (i.e. no errors) with any of: the analytical Jacobian or -snes_fd or -snes_fd_color or -snes_mf.</div><div><br></div><div>Ed</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 2, 2017 at 6:23 PM, Jed Brown <span dir="ltr"><<a href="mailto:jed@jedbrown.org" target="_blank">jed@jedbrown.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The issue is that we need to create<br>
<br>
  a*I - Jrhs<br>
<br>
and this is currently done by creating a*I first when we have separate<br>
matrices for the left and right hand sides.  There is code to just scale<br>
and shift Jrhs when there is no IJacobian, but the creation logic got<br>
messed up at some point (or at least for some TS configurations that are<br>
common).  We were discussing this recently in a performance context and<br>
this branch is supposed to fix that logic.  Does this branch work for<br>
you?<br>
<br>
<a href="https://bitbucket.org/petsc/petsc/pull-requests/655/fix-flaw-with-tssetrhsjacobian-and-no/diff" rel="noreferrer" target="_blank">https://bitbucket.org/petsc/<wbr>petsc/pull-requests/655/fix-<wbr>flaw-with-tssetrhsjacobian-<wbr>and-no/diff</a><br>
<div class="HOEnZb"><div class="h5"><br>
Ed Bueler <<a href="mailto:elbueler@alaska.edu">elbueler@alaska.edu</a>> writes:<br>
<br>
> Dear PETSc --<br>
><br>
> I have a TS-using and DMDA-using code in which I want to set a RHSJacobian<br>
> which is only approximate.  (The Jacobian uses first-order upwinding MOL<br>
> while the RHSFunction uses a flux-limited MOL.)  While it works with the<br>
> analytical Jacobian, and -snes_fd, and -snes_fd_color, and -snes_mf, I get<br>
> a "No support ..." message for -snes_mf_operator.<br>
><br>
> It suffices to show the problem with<br>
><br>
> src/ts/examples/tutorials/ex2.<wbr>c<br>
><br>
> (Note ex2.c does not use DMDA so ..._color is not available for ex2.c.)<br>
><br>
> Error as follows:<br>
><br>
> ~/petsc/src/ts/examples/<wbr>tutorials[master*]$ ./ex2 -ts_dt 0.001<br>
> -ts_final_time 0.001 -snes_monitor<br>
>     0 SNES Function norm 1.059316422854e+01<br>
>     1 SNES Function norm 1.035505461114e-05<br>
>     2 SNES Function norm 5.498223366328e-12<br>
> ~/petsc/src/ts/examples/<wbr>tutorials[master*]$ ./ex2 -ts_dt 0.001<br>
> -ts_final_time 0.001 -snes_monitor -snes_fd<br>
>     0 SNES Function norm 1.059316422854e+01<br>
>     1 SNES Function norm 1.208245988550e-05<br>
>     2 SNES Function norm 6.022374930788e-12<br>
> ~/petsc/src/ts/examples/<wbr>tutorials[master*]$ ./ex2 -ts_dt 0.001<br>
> -ts_final_time 0.001 -snes_monitor -snes_mf<br>
>     0 SNES Function norm 1.059316422854e+01<br>
>     1 SNES Function norm 6.136984336801e-05<br>
>     2 SNES Function norm 5.355730806625e-10<br>
> ~/petsc/src/ts/examples/<wbr>tutorials[master*]$ ./ex2 -ts_dt 0.001<br>
> -ts_final_time 0.001 -snes_monitor -snes_mf_operator<br>
>     0 SNES Function norm 1.059316422854e+01<br>
> [0]PETSC ERROR: --------------------- Error Message<br>
> ------------------------------<wbr>------------------------------<wbr>--<br>
> [0]PETSC ERROR: No support for this operation for this object type<br>
> [0]PETSC ERROR: Mat type mffd<br>
> [0]PETSC ERROR: See <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html" rel="noreferrer" target="_blank">http://www.mcs.anl.gov/petsc/<wbr>documentation/faq.html</a> for<br>
> trouble shooting.<br>
> [0]PETSC ERROR: Petsc Development GIT revision: v3.7.5-3426-g0c7851c  GIT<br>
> Date: 2017-04-01 18:40:06 -0600<br>
> [0]PETSC ERROR: ./ex2 on a linux-c-dbg named ed-lemur by ed Sun Apr  2<br>
> 17:02:47 2017<br>
> [0]PETSC ERROR: Configure options --download-mpich --with-debugging=1<br>
> [0]PETSC ERROR: #1 MatZeroEntries() line 5471 in<br>
> /home/ed/petsc/src/mat/<wbr>interface/matrix.c<br>
> [0]PETSC ERROR: #2 TSComputeIJacobian() line 965 in<br>
> /home/ed/petsc/src/ts/<wbr>interface/ts.c<br>
> [0]PETSC ERROR: #3 SNESTSFormJacobian_Theta() line 515 in<br>
> /home/ed/petsc/src/ts/impls/<wbr>implicit/theta/theta.c<br>
> [0]PETSC ERROR: #4 SNESTSFormJacobian() line 5078 in<br>
> /home/ed/petsc/src/ts/<wbr>interface/ts.c<br>
> [0]PETSC ERROR: #5 SNESComputeJacobian() line 2276 in<br>
> /home/ed/petsc/src/snes/<wbr>interface/snes.c<br>
> [0]PETSC ERROR: #6 SNESSolve_NEWTONLS() line 222 in<br>
> /home/ed/petsc/src/snes/impls/<wbr>ls/ls.c<br>
> [0]PETSC ERROR: #7 SNESSolve() line 3967 in<br>
> /home/ed/petsc/src/snes/<wbr>interface/snes.c<br>
> [0]PETSC ERROR: #8 TS_SNESSolve() line 171 in<br>
> /home/ed/petsc/src/ts/impls/<wbr>implicit/theta/theta.c<br>
> [0]PETSC ERROR: #9 TSStep_Theta() line 211 in<br>
> /home/ed/petsc/src/ts/impls/<wbr>implicit/theta/theta.c<br>
> [0]PETSC ERROR: #10 TSStep() line 3843 in<br>
> /home/ed/petsc/src/ts/<wbr>interface/ts.c<br>
> [0]PETSC ERROR: #11 TSSolve() line 4088 in<br>
> /home/ed/petsc/src/ts/<wbr>interface/ts.c<br>
> [0]PETSC ERROR: #12 main() line 194 in<br>
> /home/ed/petsc/src/ts/<wbr>examples/tutorials/ex2.c<br>
> [0]PETSC ERROR: PETSc Option Table entries:<br>
> [0]PETSC ERROR: -snes_mf_operator<br>
> [0]PETSC ERROR: -snes_monitor<br>
> [0]PETSC ERROR: -ts_dt 0.001<br>
> [0]PETSC ERROR: -ts_final_time 0.001<br>
> [0]PETSC ERROR: ----------------End of Error Message -------send entire<br>
> error message to petsc-maint@mcs.anl.gov-------<wbr>---<br>
> application called MPI_Abort(MPI_COMM_WORLD, 56) - process 0<br>
> [unset]: aborting job:<br>
> application called MPI_Abort(MPI_COMM_WORLD, 56) - process 0<br>
><br>
> Is this intended or a bug?  If it is intended, what is the issue?<br>
><br>
> I am using current master branch (commit<br>
> 0c7851c55cba8e40da5083f79ba1ff<wbr>846acd45b2).<br>
><br>
> Thanks for your help and awesome library!<br>
><br>
> Ed<br>
><br>
><br>
><br>
><br>
><br>
> --<br>
> Ed Bueler<br>
> Dept of Math and Stat and Geophysical Institute<br>
> University of Alaska Fairbanks<br>
> Fairbanks, AK 99775-6660<br>
> 301C Chapman<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Ed Bueler<br>Dept of Math and Stat and Geophysical Institute<br>University of Alaska Fairbanks<br>Fairbanks, AK 99775-6660<br>301C Chapman<br></div></div></div>
</div>