> > > Yeah, but they are sparse quadratures. That's sort of how Stefano has > implemented it, though the concept should be generalized and > fixtime=PETSC_MIN_REAL is not a nice way to denote an integral. > > My quadrature implementation is very primitive: it is just function sampling and trapezoidal rule. Having fixtime=PETSC_MIN_REAL is just a simple way to have both kind of objectives under the same API, and I'm open to suggestions.
> >> Both methods need the Jacobian of the DAE wrt the parameters: H > >> TSAdjointSetRHSJacobian(), S TSSetGradientDAE() > >> > > > > Here I understand Stefano to be using DAE in the following sense: Suppose > > my continuous problem is a Partial Differential-Algebraic Equation > (PDAE). > > Then after discretizing in space, which I would call Method of Lines, I > am > > left with a Differential-Algebraic Equation (DAE) in time. > > Yeah, but the method isn't very useful in that context. Fortunately, > TSCreateAdjointTS() is an interface that makes it easy to replace the > adjoint of the spatially-discretized operator with the discretization of > the adjoint (i.e., call TSSetComputeRHSJacobian(tsadj, ...)). > Wait, you are mixing two "Jacobians here", and this is why I prefer to call gradient one of them The one (let's call it J_m) you set with TSSetGradientDAE() (and TSAdjointSetRHSJacobian(), bad name) is needed by the quadrature rule for \int J_m^T L . The one that instead you can set via TSSetComputeRHSJacobian(tsadj, aJ...)). is for the adjoint DAE, i.e. Ldot = L^T * aJ -- Stefano
