Rob
Ansys Employee

There's a flag in the code to retain gradient data after it's used in the solver. If you don't some of the gradients aren't there to use in UDFs. 

/solve/set/advanced/retain-temporary-solver-mem    and "yes" when asked. 

This assumes you have sufficient UDM and UDS assigned in the case.