In thermodynamics , thermal energy is the internal energy present in a system in a state of thermodynamic equilibrium because of its temperature . This work may be used in heat engines to convert thermal energy into mechanical energy . When two systems have reached a thermodynamic equilibrium , they have attained the same temperature and the net exchange of thermal energy ceases .