<div dir="ltr">Works for my code and ts/../ex2.c ... as you probably know.<div><br></div><div>Ed</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Apr 2, 2017 at 9:54 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@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"><br>
   Jed,<br>
<br>
    Here is the problem.<br>
<br>
<a href="https://bitbucket.org/petsc/petsc/branch/barry/fix/even-huger-flaw-in-ts" rel="noreferrer" target="_blank">https://bitbucket.org/petsc/<wbr>petsc/branch/barry/fix/even-<wbr>huger-flaw-in-ts</a><br>
<div><div class="h5"><br>
<br>
> On Apr 2, 2017, at 10:39 PM, Ed Bueler <<a href="mailto:elbueler@alaska.edu">elbueler@alaska.edu</a>> wrote:<br>
><br>
> I checked out branch barry/fix-huge-flaw-in-ts (see pull request #655) and reconfigured and rebuilt.<br>
><br>
> No, the ts/.../ex2.c example is not fixed.  It gives same error:<br>
><br>
> ~/petsc/src/ts/examples/<wbr>tutorials[barry/fix-huge-flaw-<wbr>in-ts*]$ ./ex2 -ts_dt 0.001 -ts_final_time 0.001 -snes_monitor -snes_mf_operator<br>
>     0 SNES Function norm 1.059316422854e+01<br>
> [0]PETSC ERROR: --------------------- Error Message ------------------------------<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 trouble shooting.<br>
> [0]PETSC ERROR: Petsc Development GIT revision: v3.7.5-3346-g41a1d4d  GIT Date: 2017-03-24 14:39:28 -0500<br>
> [0]PETSC ERROR: ./ex2 on a linux-c-dbg named bueler-leopard by ed Sun Apr  2 18:31:55 2017<br>
> [0]PETSC ERROR: Configure options --download-mpich --with-debugging=1<br>
> [0]PETSC ERROR: #1 MatZeroEntries() line 5471 in /home/ed/petsc/src/mat/<wbr>interface/matrix.c<br>
> [0]PETSC ERROR: #2 TSComputeIJacobian() line 942 in /home/ed/petsc/src/ts/<wbr>interface/ts.c<br>
> [0]PETSC ERROR: #3 SNESTSFormJacobian_Theta() line 515 in /home/ed/petsc/src/ts/impls/<wbr>implicit/theta/theta.c<br>
> [0]PETSC ERROR: #4 SNESTSFormJacobian() line 5055 in /home/ed/petsc/src/ts/<wbr>interface/ts.c<br>
> [0]PETSC ERROR: #5 SNESComputeJacobian() line 2276 in /home/ed/petsc/src/snes/<wbr>interface/snes.c<br>
> [0]PETSC ERROR: #6 SNESSolve_NEWTONLS() line 222 in /home/ed/petsc/src/snes/impls/<wbr>ls/ls.c<br>
> [0]PETSC ERROR: #7 SNESSolve() line 3967 in /home/ed/petsc/src/snes/<wbr>interface/snes.c<br>
> [0]PETSC ERROR: #8 TS_SNESSolve() line 171 in /home/ed/petsc/src/ts/impls/<wbr>implicit/theta/theta.c<br>
> [0]PETSC ERROR: #9 TSStep_Theta() line 211 in /home/ed/petsc/src/ts/impls/<wbr>implicit/theta/theta.c<br>
> [0]PETSC ERROR: #10 TSStep() line 3820 in /home/ed/petsc/src/ts/<wbr>interface/ts.c<br>
> [0]PETSC ERROR: #11 TSSolve() line 4065 in /home/ed/petsc/src/ts/<wbr>interface/ts.c<br>
> [0]PETSC ERROR: #12 main() line 194 in /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 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>
> Curiously, my own code (attached), which differs from ex2.c in that it uses DMDA, *does* change behavior to a DIVERGED_NONLINEAR_SOLVE error:<br>
><br>
> $ ./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<br>
> solving on 5 x 5 grid with dx=0.2 x dy=0.2 cells, t0=0.,<br>
> and initial step dt=0.01 ...<br>
> 0 TS dt 0.01 time 0.<br>
>     0 SNES Function norm 2.1277<br>
> [0]PETSC ERROR: --------------------- Error Message ------------------------------<wbr>------------------------------<wbr>--<br>
> [0]PETSC ERROR:<br>
> [0]PETSC ERROR: TSStep has failed due to DIVERGED_NONLINEAR_SOLVE, increase -ts_max_snes_failures or make negative to attempt recovery<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 trouble shooting.<br>
> [0]PETSC ERROR: Petsc Development GIT revision: v3.7.5-3346-g41a1d4d  GIT Date: 2017-03-24 14:39:28 -0500<br>
> [0]PETSC ERROR: ./advect on a linux-c-dbg named bueler-leopard by ed Sun Apr  2 18:34:18 2017<br>
> [0]PETSC ERROR: Configure options --download-mpich --with-debugging=1<br>
> [0]PETSC ERROR: #1 TSStep() line 3829 in /home/ed/petsc/src/ts/<wbr>interface/ts.c<br>
> [0]PETSC ERROR: #2 TSSolve() line 4065 in /home/ed/petsc/src/ts/<wbr>interface/ts.c<br>
> [0]PETSC ERROR: #3 main() line 314 in /home/ed/repos/p4pdes/c/ch9/<wbr>advect.c<br>
> [0]PETSC ERROR: PETSc Option Table entries:<br>
> [0]PETSC ERROR: -adv_circlewind<br>
> [0]PETSC ERROR: -adv_conex 0.3<br>
> [0]PETSC ERROR: -adv_coney 0.3<br>
> [0]PETSC ERROR: -adv_firstorder<br>
> [0]PETSC ERROR: -da_refine 0<br>
> [0]PETSC ERROR: -snes_mf_operator<br>
> [0]PETSC ERROR: -snes_monitor_short<br>
> [0]PETSC ERROR: -snes_rtol 1.0e-4<br>
> [0]PETSC ERROR: -ts_dt 0.01<br>
> [0]PETSC ERROR: -ts_final_time 0.01<br>
> [0]PETSC ERROR: -ts_monitor<br>
> [0]PETSC ERROR: -ts_type beuler<br>
> [0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov-------<wbr>---<br>
> application called MPI_Abort(MPI_COMM_WORLD, 91) - process 0<br>
> [unset]: aborting job:<br>
> application called MPI_Abort(MPI_COMM_WORLD, 91) - process 0<br>
><br>
> Previously it gave a "No support for this operation for this object type ... Mat type mffd" error like ex2.c.  Progress?<br>
><br>
> 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.<br>
><br>
> Ed<br>
><br>
><br>
><br>
> On Sun, Apr 2, 2017 at 6:23 PM, Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br>
> 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>
><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>
><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>> <advect.c><br>
<br>
</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>