Thermionic and tunneling cooling thermodynamics