Radial field on independent mesh and dolfin-adjoint

I would like to create a radial deformation field of type V(x) = g(X)W(x) acting on some mesh, where X = x/|x| and g(x) is a scalar function on a unit sphere (an independent mesh), and I would like to do this in a way that is compatible with dolfin-adjoint.

An example for W follows, which should interface well with dolfin-adjoint:

n = sqrt(dot(x,x)) # works in any dimension
W = Constant(0.5)*(Constant(2.0)-n)*(x/n)

W_m = project(W, VD) # VD is some VectorFunctionSpace on the deformable mesh

plot(mesh)
plt.show()
ALE.move(mesh, W_m)
plot(mesh)
plt.show()

This produces, for an annulus mesh:

Schermata da 2022-07-09 18-11-34

Schermata da 2022-07-15 18-50-52

What remains to be defined is an independent spherical mesh, set up g on there, and then evaluate g(x/|x|), where x is taken from the original mesh. Is there any way these steps can be accomplished, compatibly with dolfin-adjoint? We can suppose I have my spherical mesh already.