# Internal energy, enthalpy, and work in the atmosphere

I'm writing a toy radiative-convective atmospheric model and need to relate the heat flux convergences (either surface sensible heat flux or the radiative flux) to changes in atmospheric layer temperatures. The first law of thermodynamics states:

The change in internal energy of a closed system is equal to the amount of heat supplied to the system plus the work done on the system by the surroundings.

My question is: Should gravitational potential energy be directly incorporated into this in any way, and where? When I calculate the internal energy of the layer, should that be just the thermodynamic internal energy $\rho c_v T$ or should it also include the potential energy $\rho g z$? The pressure work done on the system by its surroundings at the bottom of the layer is $p_{bot} \Delta z_{bot}$, which is clearly related to the raising and lowering of the layer. Should this work then be excluded from the RHS if the potential energy is excluded from the LHS?

I essentially have the following possibilities for calculating the change in temperatures:

• $\int_{z_{bot}}^{z_{top}} dz \, \rho c_v \Delta T = \Delta E_{rad}$
• $\int_{z_{bot}}^{z_{top}} dz \, (\rho c_v \Delta T + \rho g z) = \Delta E_{rad}$
• $\int_{z_{bot}}^{z_{top}} dz \, \rho c_v \Delta T = \Delta E_{rad} + p_{bot} \Delta z_{bot} - p_{top} \Delta z_{top}$
• $\int_{z_{bot}}^{z_{top}} dz \, (\rho c_v \Delta T + \rho g z) = \Delta E_{rad} + p_{bot} \Delta z_{bot} - p_{top} \Delta z_{top}$

It seems like the first and last of these are equivalent (at least assuming hydrostatic balance), but the first would use the isochoric heat capacity and the last the isobaric heat capacity. I believe the last one is the correct choice but I feel very unsure about it. The same dilemma persists when a surface heat flux is applied, or convection changes the height of the upper atmosphere without changing any of its temperatures.

Relatedly, the full equation in a fluid dynamics point of view would include kinetic energy, and for an RCE model that would be turbulent kinetic energy. Should this be tracked? If I exclude it, is that the same as assuming that all kinetic energy gets turned into heat by viscosity between each timestep?

(These may be very basic questions to some of you, but for the life of me I can't convince myself of the right approach to take. I don't have any of my atmospheric science books with me, so if you throw in a reference, please make it to an online resource.)