In engineering and thermodynamics , a heat engine converts heat energy to mechanical work by using the temperature difference between a hot `` source '' and a cold `` sink '' . In thermodynamics , a heat engine is a system that performs the conversion of heat or thermal energy to mechanical work .