idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.76k stars 1.05k forks source link

Custom residual vector derivatives for optimization problems #20063

Open dschwen opened 2 years ago

dschwen commented 2 years ago

Reason

Optimization problems (as @lynnmunday is working on as a PI) require the derivatives of the residual vector R of the problem with respect to the input parameters p, *∂R**/p***. We would like to utilize automatic differentiation for this.

The compute workflow would be similar to how the Jacobian matrix *∂R**/ui is built, except we would only need ∂**R/∂**p*** at the end of a time step.

Design

Impact

Enable correct gradients for non-linear optimization problems

YaqiWang commented 2 years ago

Can we handle a parameter in a step function z>p ? 1 : 0? I am questioning because I think it could be better to have number of parameters separate residual evaluations to get the derivatives before doing anything further. Assuming everything can be handled locally can be dangerous, otherwise we possibly could call computeResidual multiple times without AD.

tegrubbs commented 1 year ago

Have there been any updates on this issue? My group is interested in this particular use-case described by @dschwen.

lynnmunday commented 1 year ago

@tegrubbs There is an optimization module that was merged that gives you an interface to the petsc optimization solver TAO. We haven't done anything for these automatic derivatives yet, @oanaoana is working on this.