General Principles of Heat Flow Inside Stars
Before discussing how protostars move to the Main Sequence, we should discuss heat flow inside stars. Inside a star the hot gases in each region radiate heat in all directions. Heat flows into each region from the hot gases above and below it, and energy may also be generated through nuclear reactions if the region is close to the center of the star, or through gravitational contraction. All these energy flows must balance in a particular way, or the region would be heating up and expanding, or cooling off and contracting. To be specific, there must be a net flow of heat from the lower regions towards the higher ones which is exactly equal to the rate at which heat is lost at the surface, after subtracting any energy generation in the layers lying closer to the surface.
If you were inside a star you could not tell which way is up, because you could only see a short distance through the gases, and conditions would be almost the same throughout the region you could see. Under these circumstances light will flow upwards only if there happens to be more light coming from lower layers than from upper ones. Since there is no way to tell which way is up (and even if there were the pieces of atoms which make up the plasma inside a star wouldn't care which way is up), this requires that
each layer must be brighter than the layer above it. In fact, if we define a "layer" as the distance that you can see through the gas looking upwards or downwards, then at the bottom of each layer the gas must be brighter than at the top by approximately the surface brightness of the star (less, as noted below, any energy generated through nuclear reactions in the layers above the one in question).
As an example of how this works, consider the Sun's radiation. At the surface it gives off over a million watts of power per square foot. Since there is no significant light coming into the Sun from outer space, this produces a net outward flow of radiation of over a million watts per square foot. Now let's suppose that we were to move inwards by a distance equal to however far you can see downward if you were at the surface (which is approximately the same as the bottom of the photosphere). This would require you to go downward several miles, because near the surface, the gases are much thinner (more rarefied) than the air at the surface of the Earth. At this new location, there would be more than a million watts of power per square foot headed downwards from the surface (remember, the gases don't know which way is up, so if there is a given amount of energy headed away from the Sun at the surface, then there must be an equal amount headed towards the side and downwards as well). But the
net outward flow of radiation in the lower layer has to be the same million or so watts per square foot as at the surface. If there is a downward flow equal to this, then the outward flow at the bottom of this layer would have to be more than
two million watts per square foot. Similarly, at the bottom of the layer below that the outward flow would have to be over three million watts per square foot, and, if we continue to go downwards, defining each layer as the distance you can see from the previous layer above it, by the time you are a million layers below the surface, the brightness of the gas would have to be more than a
million million watts per square foot.
Of course if each layer were several miles thick, as the layers near the surface are, then there wouldn't be room for a million layers of this sort inside the Sun. But as you go inwards the gas becomes denser and denser as a result of its compression by the gases lying above it. At the surface the Sun's gases are hundreds of times thinner than the air at the surface of the Earth, but by the time you are halfway into the Sun the gases are hundreds of thousands of times denser than that, and in fact are denser than water, despite the fact that they are primarily made of pieces of hydrogen and helium atoms, which in liquid form would be considerably less dense than water; and in the center of the Sun we estimate that the gases are another hundred times denser (more than 100 times the density of water), or nearly a billion times denser than at the surface. Because of this increase in density, although near the surface a "layer" or "step" into the Sun would be several miles, near the center each step is only a fraction of an inch, and the total number of "layers" from the surface to the center is numbered in the trillions, which means that in the center the gas must be giving off something of the order of several million trillion watts of power per square foot (this is assuming that the increase in brightness is always the same as near the surface, which isn't quite true, but is close enough for a rough approximation).
At the surface of a star and inside the star the fact that you can't see all the way through the gas, as you can in the atmosphere (which is
defined as the region that you can look through) causes the gas to absorb and radiate light in the same way as so-called
black-body radiation. For black-body radiation, one thing and one thing only determines the brightness of the gas, namely its temperature. So to have a continual increase in brightness as you go downward into the Sun, you have to have a continual increase in temperature as well. To see how much of a temperature increase is required, we use a relationship called
Stefan's Law: