In general an engine converts energy to mechanical work .
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 '' .