Optimal results for parabolic problems arising in some physical models with critical growth in the gradient respect to a Hardy potential