I was wondering if dolfin adjoint can deal with functions for forms as cost functions. Specifically, id like to know if it can differentiate and optimize things like
J(W) = \int {f(W)}dx+\log (\int u_W(t = T, x)dx),
where u_W(t = T,x) is the solution at time T of a partial differential equation containting W as a source term, i.e something like \partial_t u_W = \nabla^2 u_W + W(x,t)u_W. I know I could just compute the derivatives manually in terms of the inner forms: