Who discovered the link between mechanical work and the generation of heat