Gradient alon 1d curve in 3d mesh

Hello, I have a 3D volume mesh whose surface is a 2D manifold, and that manifold’s boundary is a 1D curve. I want to compute the directional derivative of v along this 1D boundary. The following expressions seems not be correct.

grad(v).Trace()*grad(v).Trace() * ds(definedon=self.mesh.BBoundaries(".*"))
grad(v)* grad(v)* ds(self.mesh.BBoundaries(".*"))

if v is a GridFunction

grad(v).Trace().Trace()* grad(v).Trace().Trace()* ds(self.mesh.BBoundaries(".*"))

if v is a trialfunction

Thank you so much. That works.