There is no functionality with dolfin-adjoint for cross mesh assignment. Hopefully, in the future this might supported, with the MeshView
functionality recently added to dolfin. However this is not on anyone’s list of priorities.
What you could do is to use the full mesh for both problems, using A.ident_zeros()
on the assembled matrix to make sure the matrix is invertible if only consisting of parts of the mesh.
This method is for instance used to project facet-normals (How to plot normal unit vector of faces in a 2D mesh?) and compute mesh curvature (How to compute curvature of a boundary)