Variational formulation of a rod under torsional vibration for crack identification