How to save deformation gradient tensor
# kinematics d = u.geometric_dimension() I = Identity(d) F = I + grad(u) C = F.T*F B = F*F.T J = det(F) . . . . . eq = inner(P,grad(du))*dx + inner(J-1,dp)*dx Jac = derivative(eq, up) . . solve(eq==0,up,bcs,J=Jac)
I want to print or save the deformation gradient tensor (F) during solving this problem. I tried to save it as an array but that results in error. Can anyone suggest how to save the deformation gradient tensor to a file. Also if i want to print or use a particular component of the deformation gradient tensor then how to go about that ?
TFE = TensorElement(u.ufl_element().sub_elements(), shape = (d,d)) TensorSpace = FunctionSpace(mesh, TFE) F_proj = project(F, TensorSpace) # Save to File File('defgrad.pvd') << F_proj