I’m currently working on a time-dependent PDE constrained code.
In order to get the gradient of the objective with respect to the parameters,  
one needs to solve the linear adjoint PDE in the \lambda variables

\partial_x g + \lambda^T ( \partial_x F (x(t),xp(t),t) - \frac{d}{dt} 
\partial_{xp} F(x(t),xp(t),t) ) - (\frac{d}{dt} \lambda)^T \partial_{xp} 
F(x(t),xp(t),t) 

with t going form final_time to initial_time.

With this API, we will have all the ingredients (expect the forcing term 
\partial_x g, that should be provided by the user, and \frac{d}{dt} 
\partial_{xp} F, that will need an additional API) to automate PDE constrained 
gradients in PETSc, and also have the “mass matrix” that Barry was asking for.

If \frac{d}{dt} \partial_{xp} F is 0 (i.e., the mass matrix is not time 
dependent), you can get the shifted Jacobian of the adjoint PDE from the 
shifted Jacobian of the forward PDE.
However, to compute the residual, you still need the separate evaluation of  
\partial_x F (x(t),xp(t),t) and  \partial_xp F (x(t),xp(t),t).
You can infer them using the current API, but requires a couple of matrix 
evaluations of the shifted Jacobian and few AXPY.





> On Jul 29, 2017, at 9:05 AM, Jed Brown <[email protected]> wrote:
> 
> Stefano Zampini <[email protected] 
> <mailto:[email protected]>> writes:
> 
>> 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.
> 
> In what circumstances do we need these separately, versus the weighted
> sum that IJacobian produces?

Reply via email to