A star is in thermal equilibrium when it maintains a steady temperature. So, for a star like the Sun which is losing energy to radiation, this means that the Sun must generate an amount of energy which just compensates for this loss. Planets like Jupiter, Saturn, and Neptune are examples of things which are not in strict thermal equilibrium. They were formed hot 4.6 billion years ago and have been cooling off since then.
Losses + Energy Generation = 0
at all points in the star.
Now let us look at the Sun and see what sort of energy generation is required for the Sun. The way to start is to consider what sorts of conditions need to be satisfied.
The combination of these two things says that the Sun must have produced a huge amount of energy over its lifetime. We have Energy = Luminosity x Age of the Earth Let's see, 1 Joule = 10**7 ergs and 1 year ~ 31,000,000 seconds and so (in c.g.s. units), we have
Energy = 4 x 10**33 ergs per second x 1.4 x 10**17 seconds ~ 5.6 x 10**50 ergs
This is a lot of energy.
As we will find out, the energy is generated in the core of the Sun, in its inner 20 % in radius. This means that in order to have thermal equilibrium we must understand how the energy gets from the center of the Sun to the surface of the Sun. There are three main ways to transport energy:
The important transport mechanisms for the Sun are radiation and convection.