regression: combination of fully-implicit TS and DMDA generates "Object is in wrong state"
This code is an example in my book which previously worked with BDF and CN, but no more.
The code solves 2 coupled 2D diffusion-reaction equations for pattern generation. The boundary conditions are periodic and the grid is DMDA structured. (Note: the default initial conditions are such that the initial condition is essentially all zeros until sufficient refinement, e.g. -da_refine 4 or more.)
The default TS type is arkimex, and it seems to work. However, the code supplies all four call-backs, because it is part of my effort to teach ODE schemes (and related numerical concerns) by comparing schemes through run-time options.
The following run fails (on master branch) with traceback:
~/repos/p4pdes/c/ch5[master]$ ./pattern -da_refine 1 -ts_type bdf
running on 6 x 6 grid with square cells of side h = 0.416667 ...
[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
[0]PETSC ERROR: Object is in wrong state
[0]PETSC ERROR: MatSetValuesLocal() cannot proceed without local-to-global row mapping (See MatSetLocalToGlobalMapping()).
[0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
[0]PETSC ERROR: Petsc Development GIT revision: v3.13.5-2728-g1c1342fad4 GIT Date: 2020-09-04 01:27:53 +0000
[0]PETSC ERROR: ./pattern on a linux-c-dbg named system76-pc by bueler Fri Sep 4 14:05:27 2020
[0]PETSC ERROR: Configure options --download-mpich --with-debugging=1
[0]PETSC ERROR: #1 MatSetValuesLocal() line 2203 in /home/bueler/petsc/src/mat/interface/matrix.c
[0]PETSC ERROR: #2 MatSetValuesStencil() line 1595 in /home/bueler/petsc/src/mat/interface/matrix.c
[0]PETSC ERROR: #3 FormIJacobianLocal() line 283 in /home/bueler/repos/p4pdes/c/ch5/pattern.c
[0]PETSC ERROR: #4 TSComputeIJacobian_DMDA() line 130 in /home/bueler/petsc/src/ts/utils/dmdats.c
[0]PETSC ERROR: #5 TSComputeIJacobian() line 963 in /home/bueler/petsc/src/ts/interface/ts.c
[0]PETSC ERROR: #6 SNESTSFormJacobian_BDF() line 390 in /home/bueler/petsc/src/ts/impls/bdf/bdf.c
[0]PETSC ERROR: #7 SNESTSFormJacobian() line 5027 in /home/bueler/petsc/src/ts/interface/ts.c
[0]PETSC ERROR: #8 SNESComputeJacobian() line 2712 in /home/bueler/petsc/src/snes/interface/snes.c
[0]PETSC ERROR: #9 SNESSolve_NEWTONLS() line 222 in /home/bueler/petsc/src/snes/impls/ls/ls.c
[0]PETSC ERROR: #10 SNESSolve() line 4524 in /home/bueler/petsc/src/snes/interface/snes.c
[0]PETSC ERROR: #11 TSBDF_SNESSolve() line 223 in /home/bueler/petsc/src/ts/impls/bdf/bdf.c
[0]PETSC ERROR: #12 TSStep_BDF() line 283 in /home/bueler/petsc/src/ts/impls/bdf/bdf.c
[0]PETSC ERROR: #13 TSStep() line 3731 in /home/bueler/petsc/src/ts/interface/ts.c
[0]PETSC ERROR: #14 TSSolve() line 4128 in /home/bueler/petsc/src/ts/interface/ts.c
[0]PETSC ERROR: #15 main() line 117 in /home/bueler/repos/p4pdes/c/ch5/pattern.c
[0]PETSC ERROR: PETSc Option Table entries:
[0]PETSC ERROR: -da_refine 1
[0]PETSC ERROR: -ts_type bdf
[0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint@mcs.anl.gov----------
application called MPI_Abort(MPI_COMM_SELF, 117073) - process 0
[unset]: write_line error; fd=-1 buf=:cmd=abort exitcode=117073
:
system msg for write_line failure : Bad file descriptor
This run fails pretty much the same way: ./pattern -da_refine 2 -ts_type cn -ts_adapt_type basic
. However, suggesting something nontrivial, ./pattern -da_refine 1 -ts_type cn -ts_adapt_type basic
seems to complete.
These used to work on master, e.g. about a year ago.
PS: Using BDF and CN are an Exercise in the draft book. It is the only thing that seems to be broken right now, at late proof time. :-)