Thermodynamics is the branch of physics that deals with the conversion of energy (including heat) from one form into another, the direction of energy transfer between a system and its environment with the resulting variation in temperature, in general, or changes of state, and the availability of energy to do mechanical work.