The question of the second law of thermodynamics I am asking question which definitely will be considered as duplicated but I want to ask it more explicitly to prevent empty speech.
Suppose we have "closed" system which is consists of alone planet and its gas atmosphere. Planet gravitation sorts gas particles, cold are near the ground hot are on top. So $T$ distribution is not uniform, so $H$ is not maximum. So axiom (as it does not have any formal proof) known in physics as "second law of thermodynamics" is violated.
I want you to explain me what I am missing here.
At the same time, the conditions of common sense, I consider:

*

*Do not drag by the ears additional concepts that no one knew when this axiom was formulated in 19th centery.


*Use any valid math (of 19th century), but gravity must be taken into account.


*The more complex proof you involve, the more holes there can be as in a complex program, which will be found anyway.
UPDATE

*

*I asking again not to drag in unnecessary entities. There is no sun, there is just a huge cobblestone in space of mass M and gas pressed to its surface by attraction, while all this is in a mirror thermos, or in other words, we ignore the infrared radiation. In short, we are talking about the simplest model that can only be imagined and which people in the 19th century should have imagined.

*2 second law of thermodynamics: H is not decreasing during time and its is going to be maximum in closed (in terms of energy pass) system. It is violated because if we set (in our simple computer model) T to be uniformly distributed, some time pass it will not be uniformly distributed because of gravitation.

 A: I think that such an atmosphere, left to itself, is not necessarily isothermal when there are air packets moving up and down, but with enough time it will eventually become isothermal, but the timescale for this is very long. The effect of gravity is taken into account via the chemical potential, and the long-term equilibrium has higher density and higher pressure at the bottom of any air column.
A little more detail
Each cell of gas can exchange internal energy, volume and particles with its neighbours. In equilibrium the chemical potential and the temperature are uniform, because only then is there no net flow of energy and particle number up or down. The pressure is not uniform because the force on any given cell includes both a contribution from gravity and a contribution from the pressure of the adjacent cell.
A: Your mistake is in assuming that the system you describe will not come to thermal equilibrium at a uniform temperature $T$.
I imagine that your intuition is driven by the behavior of the Earth's atmosphere, which is certainly not in a state of global thermal equilibrium.  However, this non-equilibrium behavior is due to the fact that the Earth isn't an isolated system.  Energy pours in from the sun, heating both the atmosphere and the surface.  The uneven heating causes sustained temperature differences which are the ultimate drivers of nearly all of our atmospheric dynamics.
If you want to imagine what a planet and atmosphere at equilibrium would be like, then you should think about a lifeless rock in the interstellar void with no appreciable sources of internal heat such as radioactive decay (which is constantly pouring heat into the center of the Earth).  The planet and atmosphere should also be enclosed in a reflective, thermally insulating shell to prevent any radiation from entering or leaving.
After a sufficient amount of time, such a system would reach equilibrium with a uniform temperature, but it wouldn't look anything like the Earth.
A: Let me give an answer from a different point of view, besides the valid answers already given.
The second law of thermostatics says that if a system is in a stable equilibrium (under particular constraints), then its entropy has an absolute-maximum value (compatible with those constraints).
We note that this law says nothing about gradients, that is, non-uniformities. It only mentions "equilibrium".
Then how is "equilibrium" defined? Its definition depends on the specific system we're considering. A basic requirement of equilibrium is that the quantities that define the state of our system be constant in time (with respect to some reference system; note, however, that I've heard arguments even against such requirement). But equilibrium does not generally require uniformity. That is, in a state of equilibrium some systems may very well have gradients of density, temperature, or internal energy, as long as such gradients are constant in time.
A very simple example of this is a system made of two closed chambers, adiabatically insulated, with two substances in equilibrium at different temperature. Such a system is in equilibrium, satisfies the second law, and has non-uniform temperature. Note that there are non-trivial analogues of this kind (systems with uncoupled degrees of freedom, such as momentum and spin, for example).
So the fact that a system has some gradient in temperature, constant in time, does not a priori exclude that it is at equilibrium and that its entropy is at a maximum. For some systems, temperature non-uniformity might be impossible at equilibrium; but for other systems temperature uniformity might actually be impossible at equilibrium. So we cannot say in general "I see temperature non-uniformity, therefore the entropy can't be at a maximum".
Now I don't know whether the "earth" system at equilibrium has to have uniform temperature or maybe must have non-uniform temperature. The other answers reasonably argue that it should have uniform temperature. But the point is this: even if its equilibrium turned out to have non-uniform temperature, the second law wouldn't be violated a priori, because the second law doesn't require uniformity, that is, the absence of gradients, of any quantity.

Let me also counter the possible objection that a gradient in temperature, $\nabla T$, would imply a heat flux, $\pmb{q}$. First of all, the equation $\pmb{q} \propto - \nabla T$ is a constitutive equation, not a universal law. That is, it may not be valid for some materials (there maybe other microscopic phenomena, such as microscopic transport, or electromagnetic fields, that lead to a different or vanishing heat flux). Second, I can't a priori exclude a system, especially a gravitational one, with stationary, internal heat fluxes (I'm happy is someone can give me references about a general physical impossibility, or examples, of such a situation). Does "equilibrium" excludes such fluxes? This is a tricky question; the notion of equilibrium is not clearly delimited.
A: You don't need a planet - just consider a tall column of gas in a cylinder.
The energy of a molecule is $mgh+{1 \over 2} m v^2$
You argue - correctly - that a molecule needs a lot of energy to reach the upper regions, so the mean energy of molecules at the top must be greater than that of molecules at the bottom.
But this doesn't imply an increased temperature. As an energetic molecule with high $v$  travels upwards kinetic energy is converted to potential and $v$ falls, so the velocity distribution at the top is the same as the velocity distribution at the bottom.
The proof is easy.  The Boltzmann function is $P(h,v)=P(E)\propto e^{-E/kT}$ which is
$e^{-mgh/kT-{1 \over 2kT} mv^2}$. And this factorises. $P(h,v)=P_h(h)P_v(v)=e^{-mgh/kT} e^{-{1 \over 2kT} mv^2}$. (We get the barometric equation for free.) The distribution of velocities, which depends on $T$, is the same at all heights.
A: It is in no way possible for your the atmosphere to sustain a non uniform temperature distribution unless there is some external agency supplying heat to the system.
Even if your system initially starts with a non-uniform temperature distribution then too heat flow would occur between layers at different temperature. This heat flow between different layers will continue untill all the layers are in thermal equilibrium.
Now if you believe that you can have a temperature gradient by virtue of gravity then you are completely wrong. If there will be any gradient then that will be of pressure and density (at equilibrium).
