PaperProphet said:
the number of molecules at a height, in addition to the total kinetic energy at a height, can be used to calculate the average kinetic energy at that height.
Yes. More precisely, the average kinetic energy of molecules in a small increment of height from ##h## to ##h + dh## is the total kinetic energy of molecules in that small volume, divided by the number of molecules in the volume. If we take the limit as ##dh \rightarrow 0##, we have ##k T = K / n## where ##T## is the temperature (average kinetic energy), ##K## is the kinetic energy density, ##n## is the number density of molecules, and ##k## is Boltzmann's constant (which is there only to allow ##T## to have conventional units of degrees Kelvin instead of energy units).
Now, let's suppose the kinetic energy density ##K## varies with height according to your assumption--i.e., that it varies the same way the kinetic energy of a free particle does. That is just the negative of the variation in potential energy with height, i.e., for a single free particle it is ##dK / dh = - m g##, where ##m## is the mass of the particle. Here, though, we want the variation in kinetic energy density of a gas of particles, which is just ##dK / dh = - n m g##. Furthermore, the number density ##n## is just ##\rho / m##, where ##\rho## is the mass density. So we have ##dK / dh = - \rho g##.
Now, if we observe that ##K = k n T##, we can write:
$$
\frac{dK}{dh} = k \left( T \frac{dn}{dh} + n \frac{dT}{dh} \right) = - \rho g
$$
which is actually just a rewrite of the hydrostatic equilibrium equation, as we can see by observing that the gas constant ##R = k / m##, so the number density ##n## is equal to ##\rho R / k##. This let's us rewrite the above (rearranging some factors) as:
$$
\frac{dK}{dh} = RT \frac{d \rho}{dh} + R \rho \frac{dT}{dh} = - \rho g
$$
where the middle expression is obviously just ##d / dh \left( \rho R T \right)##, as we would expect by using the ideal gas equation to eliminate the pressure ##P## in the hydrostatic equilibrium equation.
So what all this is telling us is that there are two ways for the kinetic energy density to vary with height as you assume it will (i.e., as the negative of the change in gravitational potential energy with height): either the temperature ##T## can vary, or the mass density ##\rho## can vary. Of course this in itself does not prove that it is the mass density that varies, not the temperature; but all along you have been implicitly assuming that the temperature
must vary if the kinetic energy density varies. The above shows that that is not the case; it is perfectly possible for the kinetic energy density to vary with height at constant temperature, by having the mass density vary with height. That is why it is not inconsistent for the tube to be at constant temperature even though it is in a gravity field, meaning that the kinetic energy density of its molecules varies with height.
In other words, if you really want to know how the temperature varies with height in the tube, looking at the kinetic energy density (and the effect of the gravitational field on it) is a red herring. The temperature is determined by other constraints. In this scenario, you have imposed another constraint by assuming that the tube of gas is an isolated system: that means there is no heat exchange with the outside. And
that means there cannot be any heat flow anywhere in the tube (my assumption #1 many posts ago), because such a heat flow could only be sustained in equilibrium by coupling the tube to some external heat source and sink. And "no heat flow" means "no temperature difference".
So the reason the temperature of the tube is constant in your scenario is that you assumed it was, by assuming an isolated system. It has nothing to do with the gravitational field at all; if you took the same tube and put it way out in space, far from all gravitating bodies, and just let it float there, isolated from everything else, the temperature would still be constant--what would change is the density and pressure profiles (they would be constant instead of changing with height).