Yes, you can use a matrix-free approach on this matrix just like what you would do on the IJacobian matrix. Only the multTranspose operation needs to be overloaded for the adjoint.
Hong On Jul 30, 2020, at 6:52 PM, Salazar De Troya, Miguel via petsc-users <petsc-users@mcs.anl.gov<mailto:petsc-users@mcs.anl.gov>> wrote: Hi, The jacobian of the RHS w.r.t. the parameter P is a matrix that will be multiplied by the adjoint solution within TSAdjoint(). I am interested in having access to that adjoint so I can calculate shape derivatives with firedrake_adjoint. I will have to use that adjoint function, apply it to the residual and calculate the shape derivative from the resulting 0-form to obtain my RHSJacobianP*adjoint. This is the workaround done in pyadjoint: https://github.com/dolfin-adjoint/pyadjoint/blob/e6fbd13f8ac63290804852fa2f27307c44bdc9e3/dolfin_adjoint_common/blocks/solving.py#L204 Is there another alternative within PETSc? Maybe using a matrix free approach? Thanks Miguel Miguel A. Salazar de Troya Postdoctoral Researcher, Lawrence Livermore National Laboratory B141 Rm: 1085-5 Ph: 1(925) 422-6411