Heat engine and method for operating the same