Hello,
I am following this post (Derivative with respect to a tensor - FEniCS Q&A ) to calculate the derivative of energy function wrt a tensor. I am adding following lines to the hyperelasticity demo (Hyperelasticity — DOLFIN documentation):
T = TensorFunctionSpace(mesh, "Lagrange", 1)
F1 = I + grad(u)
F1 = variable(F1)
dF = diff(psi, F1)
stress = Function(T)
stress = project (dF, T)
stress.rename("stress", "stress")
fileS = File("stress.pvd")
fileS << stress
However, when I view the stress.pvd file, I get stress equal to zero all over the body. I was wondering what I am doing wrong in here?
Thanks for the help!