2017-07-24 19:28 GMT+03:00 Barry Smith <[email protected]>:

>
>
> >
> > IMHO I think that it is not worth the complication. I value the
> generality of the current API, that already is somewhat cumbersome to
> maintain.
> > Users providing the RHS function + mass matrix already know that they
> should do M^-1 * rhsvec to compute the rhs function.
>
>    Then they get wrong or confusing information with TSAdjoint, not a good
> thing.
>
>
Barry,

it seems to me that in order to get a gradient for PDE constrained
optimization out of TS, we need to be able to evaluate separately the two
PDE gradients \nabla_x F and \nabla_xp F, where F() is the time dependent
PDE in implicit form, i.e. F(x,xp,t) = 0, with xp the time derivative of
the state.

Correct me if I'm wrong, but this seems more general than,  and closely
related with your TSSetMassMatrix proposal, which I interpret as "please
give me the matrix that represents \nabla_xp F",

The API could then be

TSSetSplitJacobiansFunctions(ts,Mat,(PetscErrorCode*)(TS,Mat,X,XP,time,void*),Mat,(PetscErrorCode*)(TS,Mat,X,XP,time,void*))

This would super simplify the adjoint codes. What do you think?

Note that, if the user provides the IJacobian routine, you can always
get \nabla_xp F at the cost of two matrix evaluations (one with shift 1,
the other with shift 0) and an MatAXPY.



-- 
Stefano

Reply via email to