Spin Heat Engine Coupled to a Harmonic-Oscillator Flywheel.