Beginning with the 1st Law of Thermodynamics:
is change in internal energy
and are quantities of heat supplied to the system by its surroundings and of work done by the system on its surroundings, respectively.
When a system expands [e.g. the inflation of the atmosphere by solar radiative forcing] in a fictive quasistatic process, the work done by the system on the environment is the product, +P dV, of pressure, P, and volume change, dV, whereas the work done on the system is -P dV. Using either sign convention for work, the change in internal energy of the system is:
Applying the 1st Law to gases or the atmosphere provides these various forms for a gas of mass m:
|Note "changes in temperature result from either expansion or contraction" and "adiabatic processes play a large role in deep convective processes"|
The Poisson Relation as the entire source of the atmospheric temperature gradient (gravito-thermal greenhouse effect), not radiative forcing from greenhouse gases, was perhaps first described by the great physicist Maxwell. These same barometric relations are the basis of all the barometric formulae and the greenhouse equation.
Thus, gravity is continuously doing the work upon air packets/parcels ascending (which are accumulating gravitational potential energy) and air packets/parcels descending (which in the process are using up their gravitational potential energy in exchange for the work done by gravity on continuous compression of air packets/parcels).
This demonstrates how gravity creates the thermal gradient above and below the equilibrium temperature with the Sun, while conserving energy:
Equilibrium temperature with the Sun = 255K
Ts = temperature at Earth's surface = 288K
Tt = temperature at the tropopause = 220K at around 15,000 km height
"Average temperature" of the quasi-linear [lapse rate] temperature gradient of the troposphere:
(288K + 220K)/2 = 254K ~ 255K = Equilibrium temperature with the Sun
288K - 255K = 33C gravito-thermal greenhouse effect
Thus fulfilling the 1st law requirement of conservation of energy. (Before someone comments, I know you can't properly average temperatures, and that temperature is not a direct proxy for heat energy because calorimetry requires the mass, specific heats, heats of fusion and vaporization, and all phase changes be accounted, but use of temperature as a proxy of heat is done for illustrative purposes and simplification of the explanation)
Note the units of pressure used in the greenhouse equation are in unit atmospheres, and by definition 1 atmosphere of pressure at the surface = 1.01325×105 Newtons/meter squared, which is the continuous gravitational forcing F = mg upon the atmosphere by gravity which is producing the gravito-thermal greenhouse effect. Newton's 2nd law of motion F = ma = mg appears in the greenhouse equation as annotated below to calculate this gravitational forcing upon the atmospheric mass:
Also note, we previously calculated the adiabatic lapse rate and temperature distribution in a theoretical Earth atmosphere of 100% Nitrogen, a non-greenhouse gas, and found the adiabatic lapse rate and troposphere temperature distribution almost the same as our Earth, surface temperature warmer on the theoretical 100% Nitrogen atmosphere Earth, thus proving greenhouse gases act as cooling agents rather than warming.