Hi Jean-Paul,
thanks for pointing that out.
However, I believe there has been a misunderstanding:
I am working here with a FE discretized energy on a seperate triangulation, say, 'triangulation_energy', with the coordinates being the first and third invariant of 'C'; The corresponding nodal energy values are stored in the vector 'solution_energy' and are computed once based on a analytical energy function.
So for each quadrature point in my geometry (first triangulation) I am computing 'C=F^T*F', thence the first and third invariant of 'C' and store them in a Point<2> object denoted as 'invariant_point'.
Then, I employ 'GridTools::find_active_cell_around_point(triangulation_energy, invariant_point)' to finally create a second FEValues object with the only purpose to compute the gradient of the energy ('solution_energy') at
'invariant_point'.
'get_function_gradients(solution_energy,
grad_energy_at_ref_point
) gives me the gradient of 'solution_energy' with respect to the first and third invariant of 'C' because the real coordinates on the associated triangulation are the first and third invariant of 'C'.
Now, I have all the quantities to compute the stress tensor as
S_ad = 2*(grad_energy_at_ref_point[0][0]*invariant1_wrt_C_ad
+ grad_energy_at_ref_point[0][1]*invariant3_wrt_C_ad);
My goal is to compute the 4th order tangent \frac{\partial S_ad}{\partial C_ad}.
All that said, is it not correct to start like this?:
SymmetricTensor<2,dim> C = symmetrize(F^t *F);
ad_helper.register_independent_variable(C, C_dofs);
const SymmetricTensor<2, dim, ADNumberType> C_ad = ad_helper.get_sensitive_variables(C_dofs);
Best,
Simon