in a heat engine, as described by Carnot's theorem and the second law of thermodynamics