[petsc-dev] broken TS example related to Jacobian and coloring etc.

Peter Brune prbrune at gmail.com
Tue Aug 14 16:40:28 CDT 2012


You have one call to set the TS and SNES jacobian nested as:

TSSetRHSJacobian(ts ..);
    SNESSetJacobian(snes, .. SNESTSComputeJacobian, (void *)ts);

And then a subsequent and seemingly unrelated call to

SNESSetJacobian(snes, .. .. SNESDefaultComputeJacobianColor, PETSC_NULL);

(Where the last argument is the context in both calls, of course).

SNESDefaultComputeJacobianColor takes an optional context argument as a
user-defined coloring.  This allows people to set their own coloring if
need be; otherwise it automatically pulls one off the DM or Mat.

However, in this case, we have that there is no possibility of removing
that TS from the context spot, as PETSC_NULL is ignored.

- Peter

On Tue, Aug 14, 2012 at 4:35 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Tue, Aug 14, 2012 at 4:28 PM, Peter Brune <prbrune at gmail.com> wrote:
>
>> This is a problem I've been harping on but should harp on more; It is
>> IMPOSSIBLE to reset the context on a lot of things to null after it's been
>> set.  What's happening is that the context is being set as the TS object in
>> the previous setting of the SNES jacobian in TSSetRHSJacobian.  Then, this
>> call is expecting it to have a MatFDColoring.  I could just make
>> SNESDefaultComputeJacobianColor ignore its context argument, but I left it
>> in there so that a user could pass their own coloring in.
>>
>
> I guess I do not understand. What is the context set API? Why can't you
> pass NULL?
>
>    Matt
>
>
>>
>> It's my opinion that sticking PetscObjects in the context field like the
>> SNES wrappers for TS function and jacobian evaluations do is a bad habit.
>> However, just composing it with, say, the DM won't give us the flexibility
>> we need if, for instance, we want multilevel methods to work on this.
>>
>> - Peter
>>
>> On Tue, Aug 14, 2012 at 4:12 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>
>>>
>>>   Things are still mighty fragile ----
>>>
>>> > [0]PETSC ERROR: --------------------- Error Message
>>> ------------------------------------
>>> > [0]PETSC ERROR: Invalid argument!
>>> > [0]PETSC ERROR: Wrong type of object: Parameter # 6!
>>> > [0]PETSC ERROR:
>>> ------------------------------------------------------------------------
>>> > [0]PETSC ERROR: Petsc Development HG revision:
>>> bd03fdcd3cf87c5b29ea28a5f4737ae936d9df04  HG Date: Sat Aug 11 20:22:42 2012
>>> -0500
>>> > [0]PETSC ERROR: See docs/changes/index.html for recent updates.
>>> > [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
>>> > [0]PETSC ERROR: See docs/index.html for manual pages.
>>> > [1]PETSC ERROR: --------------------- Error Message
>>> ------------------------------------
>>> > [1]PETSC ERROR: Invalid argument!
>>> > [1]PETSC ERROR: Wrong type of object: Parameter # 6!
>>> > [1]PETSC ERROR:
>>> ------------------------------------------------------------------------
>>> > [1]PETSC ERROR: Petsc Development HG revision:
>>> bd03fdcd3cf87c5b29ea28a5f4737ae936d9df04  HG Date: Sat Aug 11 20:22:42 2012
>>> -0500
>>> > [1]PETSC ERROR: See docs/changes/index.html for recent updates.
>>> > [1]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
>>> > [1]PETSC ERROR: See docs/index.html for manual pages.
>>> > [1]PETSC ERROR:
>>> ------------------------------------------------------------------------
>>> > [1]PETSC ERROR: ./ex13 on a arch-gnu named Barrys-MacBook-Pro.local by
>>> barrysmith Mon Aug 13 21:36:58 2012
>>> > [2]PETSC ERROR: --------------------- Error Message
>>> ------------------------------------
>>> > [2]PETSC ERROR: Invalid argument!
>>> > [2]PETSC ERROR: Wrong type of object: Parameter # 6!
>>> > [2]PETSC ERROR:
>>> ------------------------------------------------------------------------
>>> > [2]PETSC ERROR: Petsc Development HG revision:
>>> bd03fdcd3cf87c5b29ea28a5f4737ae936d9df04  HG Date: Sat Aug 11 20:22:42 2012
>>> -0500
>>> > [2]PETSC ERROR: See docs/changes/index.html for recent updates.
>>> > [2]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
>>> > [2]PETSC ERROR: See docs/index.html for manual pages.
>>> > [2]PETSC ERROR:
>>> ------------------------------------------------------------------------
>>> > [2]PETSC ERROR: ./ex13 on a arch-gnu named Barrys-MacBook-Pro.local by
>>> barrysmith Mon Aug 13 21:36:58 2012
>>> > [2]PETSC ERROR: Libraries linked from
>>> /Users/barrysmith/Src/petsc-dev/arch-gnu/lib
>>> > [2]PETSC ERROR: Configure run at Sat Aug 11 20:25:02 2012
>>> > [2]PETSC ERROR: Configure options --download-blacs --download-fftw
>>> --download-hypre --download-libyaml --download-metis --download-ml
>>> --download-mpich --download-mumps --download-parmetis --download-ptscotch
>>> --download-scalapack --download-superlu --download-superlu_dist
>>> --download-triangle --download-yaml
>>> --with-ams-dir=/Users/barrysmith/Src/ams-dev --with-java --with-openmp
>>> --with-server --with-shared-libraries PETSC_ARCH=arch-gnu
>>> > [2]PETSC ERROR: [0]PETSC ERROR:
>>> ------------------------------------------------------------------------
>>> > [0]PETSC ERROR: ./ex13 on a arch-gnu named Barrys-MacBook-Pro.local by
>>> barrysmith Mon Aug 13 21:36:58 2012
>>> > [0]PETSC ERROR: Libraries linked from
>>> /Users/barrysmith/Src/petsc-dev/arch-gnu/lib
>>> > [0]PETSC ERROR: Configure run at Sat Aug 11 20:25:02 2012
>>> > [0]PETSC ERROR: Configure options --download-blacs --download-fftw
>>> --download-hypre --download-libyaml --download-metis --download-ml
>>> --download-mpich --download-mumps --download-parmetis --download-ptscotch
>>> --download-scalapack --download-superlu --download-superlu_dist
>>> --download-triangle --download-yaml
>>> --with-ams-dir=/Users/barrysmith/Src/ams-dev --with-java --with-openmp
>>> --with-server --with-shared-libraries PETSC_ARCH=arch-gnu
>>> > [0]PETSC ERROR:
>>> ------------------------------------------------------------------------
>>> > [0]PETSC ERROR: SNESDefaultComputeJacobianColor() line 50 in
>>> /Users/barrysmith/Src/petsc-dev/src/snes/interface/snesj2.c
>>> > [0]PETSC ERROR: SNESComputeJacobian() line 2079 in
>>> /Users/barrysmith/Src/petsc-dev/src/snes/interface/snes.c
>>> > [0]PETSC ERROR: SNESSolve_LS() line 198 in
>>> /Users/barrysmith/Src/petsc-dev/src/snes/impls/ls/ls.c
>>> > [0]PETSC ERROR: SNESSolve() line 3570 in
>>> /Users/barrysmith/Src/petsc-dev/src/snes/interface/snes.c
>>> > [1]PETSC ERROR: Libraries linked from
>>> /Users/barrysmith/Src/petsc-dev/arch-gnu/lib
>>> > [1]PETSC ERROR: Configure run at Sat Aug 11 20:25:02 2012
>>> > [1]PETSC ERROR: Configure options --download-blacs --download-fftw
>>> --download-hypre --download-libyaml --download-metis --download-ml
>>> --download-mpich --download-mumps --download-parmetis --download-ptscotch
>>> --download-scalapack --download-superlu --download-superlu_dist
>>> --download-triangle --download-yaml
>>> --with-ams-dir=/Users/barrysmith/Src/ams-dev --with-java --with-openmp
>>> --with-server --with-shared-libraries PETSC_ARCH=arch-gnu
>>> > [1]PETSC ERROR:
>>> ------------------------------------------------------------------------
>>> > [1]PETSC ERROR: SNESDefaultComputeJacobianColor() line 50 in
>>> /Users/barrysmith/Src/petsc-dev/src/snes/interface/snesj2.c
>>> > [1]PETSC ERROR: SNESComputeJacobian() line 2079 in
>>> /Users/barrysmith/Src/petsc-dev/src/snes/interface/snes.c
>>> > [1]PETSC ERROR: SNESSolve_LS() line 198 in
>>> /Users/barrysmith/Src/petsc-dev/src/snes/impls/ls/ls.c
>>> > [1]PETSC ERROR: SNESSolve() line 3570 in
>>> /Users/barrysmith/Src/petsc-dev/src/snes/interface/snes.c
>>> > [1]PETSC ERROR: TSStep_Theta() line 116 in
>>> /Users/barrysmith/Src/petsc-dev/src/ts/impls/implicit/theta/theta.c
>>> > [1]PETSC ERROR:
>>> ------------------------------------------------------------------------
>>> > [2]PETSC ERROR: SNESDefaultComputeJacobianColor() line 50 in
>>> /Users/barrysmith/Src/petsc-dev/src/snes/interface/snesj2.c
>>> > [2]PETSC ERROR: SNESComputeJacobian() line 2079 in
>>> /Users/barrysmith/Src/petsc-dev/src/snes/interface/snes.c
>>> > [2]PETSC ERROR: SNESSolve_LS() line 198 in
>>> /Users/barrysmith/Src/petsc-dev/src/snes/impls/ls/ls.c
>>> > [2]PETSC ERROR: SNESSolve() line 3570 in
>>> /Users/barrysmith/Src/petsc-dev/src/snes/interface/snes.c
>>> > [2]PETSC ERROR: TSStep_Theta() line 116 in
>>> /Users/barrysmith/Src/petsc-dev/src/ts/impls/implicit/theta/theta.c
>>> > [2]PETSC ERROR: TSStep() line 1977 in
>>> /Users/barrysmith/Src/petsc-dev/src/ts/interface/ts.c
>>> > [2]PETSC ERROR: TSSolve() line 2100 in
>>> /Users/barrysmith/Src/petsc-dev/src/ts/interface/ts.c
>>> > [0]PETSC ERROR: TSStep_Theta() line 116 in
>>> /Users/barrysmith/Src/petsc-dev/src/ts/impls/implicit/theta/theta.c
>>> > [0]PETSC ERROR: TSStep() line 1977 in
>>> /Users/barrysmith/Src/petsc-dev/src/ts/interface/ts.c
>>> > [0]PETSC ERROR: TSSolve() line 2100 in
>>> /Users/barrysmith/Src/petsc-dev/src/ts/interface/ts.c
>>> > [0]PETSC ERROR: main() line 108 in src/ts/examples/tutorials/ex13.c
>>> > TSStep() line 1977 in
>>> /Users/barrysmith/Src/petsc-dev/src/ts/interface/ts.c
>>> > [1]PETSC ERROR: TSSolve() line 2100 in
>>> /Users/barrysmith/Src/petsc-dev/src/ts/interface/ts.c
>>> > [1]PETSC ERROR: main() line 108 in src/ts/examples/tutorials/ex13.c
>>> > [2]PETSC ERROR: main() line 108 in src/ts/examples/tutorials/ex13.c
>>> > application called MPI_Abort(MPI_COMM_WORLD, 62) - process 0
>>> > [cli_0]: aborting job:
>>> > application called MPI_Abort(MPI_COMM_WORLD, 62) - process 0
>>> > application called MPI_Abort(MPI_COMM_WORLD, 62) - process 1
>>> > [cli_1]: aborting job:
>>> > application called MPI_Abort(MPI_COMM_WORLD, 62) - process 1
>>> > application called MPI_Abort(MPI_COMM_WORLD, 62) - process 2
>>> > [cli_2]: aborting job:
>>> > application called MPI_Abort(MPI_COMM_WORLD, 62) - process 2
>>> /Users/barrysmith/Src/petsc-dev/src/ts/examples/tutorials
>>> Possible problem with ex13_3, diffs above
>>> =========================================
>>>
>>>
>>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120814/6528dd2a/attachment.html>


More information about the petsc-dev mailing list