when any gas expands, it does work in expanding against the outside "surface" of the control volume, which comes from the internal energy - temperature - of the molecules.
The equations are commonly derived in thermodynamics undergrad courses. look up adiabatic expansion.
I still think that the radiating-into-space effect I mentioned is real. I imagine this is part of the reason there is convection in the atmosphere. But I'm out of my depth.
The equations are commonly derived in thermodynamics undergrad courses. look up adiabatic expansion.
here's a video:
https://www.youtube.com/watch?v=ObnWb7yspxA