# Gravitational potential energy, conservation of energy and first law of thermodynamics

When an isolated ideal gas gets (adiabatically) compressed due to its own gravity, its gravitational potential energy increases. Does this mean its kinetic energy will reduce (due to conservation of total energy) and the gas will cool down? Does it not violate first law of thermodynamics which says an ideal gas should heat up on compression?

• When a gas cloud collapses it heats up. The heat is lost by radiation, which allows the cloud to cool and collapse further. No conservation laws are violated. Sep 13 '15 at 4:27

$$U = -\frac{GMm}{d}$$
As $d$ decreases, $U$ becomes more negative, so less potential energy remains.