Matter in all its forms has a temperature, which can be measured in various scales. This temperature expressed in degrees Kelving is directly related to the average kinetic energy of the atoms and molecules and lattices that compose matter.
. E is the mean kinetic energy in joules (J)
. kB = 1.3806504(24)×10−23 J/K is the Boltzmann constant
. T_k is the kinetic temperature in kelvins (K)
This kinetic energy is in the form of vibrations and rotations in the solid or liquid.
At the given temperature, any body of matter will emit radiation. The charged atoms and molecules as they vibrate, interact with the spill over fields of each other and emit electromagnetic radiation, i.e. photons, characteristic with what is called the black body spectrum.
The Stephan - Bolzman law tells us how much energy is radiated away :
where j*is the total power radiated per unit area, T is the absolute temperature and σ = 5.67×10^−8 W m^−2 K^−4 is the Stefan–Boltzmann constant
In space without any incoming radiation a body will cool finally to absolute zero.
If incoming radiation falls on the body it will absorb it and distribute it as kinetic energy in the various degrees of freedom of the atoms, molecules and lattice, raising its temperature.
A body in a heat bath will be in equilibrium, radiating and absorbing the same amount of energy and keeping a constant temperature.
Note: gases behave with a different energy loss functional form then the SB above, because the degrees of freedom for vibrations and rotations are less in a gas and it is only the translational degrees and the soft collisions that are responsible for the radiation of photons and the diminution of kinetic energy and subsequent cooling.