Dear all,
In my fenics code, I need to calculate \frac{\nabla d}{|| \nabla d ||}. Here d is a Function, as shown below:
from dolfin import *
V_d = FunctionSpace(mesh, "CG", 1)
d = Function(V_d, name = "d")
norm_of_grad_d = ???????
object_1 = grad(d)/norm_of_grad_d
I used norm(grad(d))
before, but I got the error “TypeError: Do not know how to compute norm of grad(d)”. I checked the definition of norm() and I think its argument can only be Vector or Function, so this error occurred.
So does anyone know how to calculate the norm of grad(d) correctly? I appreciate any help.