Numerical approximation of dynamic deformations of a thermoviscoelastic rod against an elastic obstacle