Variational derivatives should always differentiate a scalar object. However, in many cases it is possible to extend the concept to deal with a non-scalar object, and this has been requested multiple times in this group. So now VarD starts by checking whether its "numerator" is scalar or not, and if it is not a scalar the message "VarD::nouse: Attempting to apply VarD on a non-scalar expression." is printed and VarD switches to the internal function NonScalarVarD.
What this function NonScalarVarD does is contracting the non-scalar object to differentiate with a temporary tensor of complementary free indices, so that now we have a scalar. Then proceeds with the differentiation and finally removes the temporary tensor. The code is this:
NonScalarVarD[tensor_, der_][expr_] :=
With[{inds = ChangeIndex /@ FindFreeIndices[expr]},
With[{tmp = Tensor["TMP", SignedVBundleOfIndex /@ inds, DependenciesOf[expr]] @@ inds},
IndexCoefficient[VarD[tensor, der][tmp expr], tmp]
]
];
For the particular case of a single tensor being differentiated with respect to itself, this is equivalent to the code that Leo posted, and which was being used before. That previous code was probably easier to understand: a product of deltas was constructed and then projected to impose the symmetry of the tensor in both sets of indices (those of the "numerator" and the "denominator" of VarD).
If you want to understand what the new code above does, I recommend you evaluate step by step those instructions. Note it uses the not-yet-public notation Tensor[...], that avoids going through DefTensor and UnDefTensor for temporary tensors.
Cheers,
Jose.