[petsc-dev] add TSGetIJacobian()

Jed Brown jed at 59a2.org
Fri Mar 19 07:34:26 CDT 2010


On Thu, 18 Mar 2010 16:23:15 -0300, Lisandro Dalcin <dalcinl at gmail.com> wrote:
> Jed, could you add a TSGetIJacobian(ts, &A, &B, &f, &ctx) call in
> petsc-release-31?

I can do this, but what should the behavior be if the user has not set
an IJacobian (e.g. they are using RHSJacobian)?  Currently everything
that uses IJacobian works transparently when the RHS form is used
instead of the Implicit form.  I'm hesitant to have a "dumb" accessor
because this is likely to be surprising when TSGetIJacobian returns NULL
even though TSComputeIJacobian will work fine (because the user employed
the RHS interface).  Perhaps the right thing is to return a new function
that evaluates the implicit Jacobian (basically the body of the else in
TSComputeIJacobian), but I think this could also be surprising.

Note that if all you want are the matrices, then TSGetRHSJacobian will
give them to you (not that this is good either, but with the current
design, the caller kind of has to know which interface (nonlinear versus
linear variants) is being used).

Do you have opinions about this?  I'm not wild about a function that
can't be used correctly without the caller having an unreasonable amount
of knowledge.  Symmetry implies that TS also need getters for
RHSFunction, IFunction, pre- and post-steps, step adaptors, and
acceptance testers.

Jed



More information about the petsc-dev mailing list