A star is a self gravitating ball of gas. There are two basic forces at work, on one hand gravity, which is attempting to make the star collapse inward on itself, and on the other hand there is the generation of energy and pressure from within the star, which holds the star up.
The sun radiates 1.374 ×10^{6} ergs/sec/cm^{2} at the surface of the Earth, or about 1.4 kW per square meter, a quantity called the solar constant. The Sun's mean distance from us is 1.496 ×10^{13} cm (or 1 astronomical unit = 1 A.U.) and hence its luminosity is
 (1) 
If there were no outward force holding a star up against gravity, how long would it take to collapse? This quantity is called the ``freefall'' time scale, t_{ff}.
We allow a test particle to fall from the surface of the star of radius R and mass M. Its distance from the star center is given by r. Its acceleration is then
 (2) 
where G is the gravitational constant.
Integrating this equation, and using the boundary condition r = R at t = 0, leads to the freefall time
 (3) 
Problem 3.1 Show that t_{ff} has the dimension of time.

Using the mass and radius of the Sun,
 (4) 
we derive the Solar free fall time t_{ff} = 27 minutes.
Problem 3.2 Show that the freefall time can be expressed
Verify the freefall time for the Sun of approx 27 minutes.

This is a very short time! The Sun would collapse on this timescale were it not for the pressure support due to the outward flow of generated energy.
Problem 3.3 Note that the freefall time is proportional to M/R^{3}, which is a density. What is the freefall time expressed as a function of the mean density of an object of mass M and radius R?

One idea proposed in the 19th century as the source of the Sun's energy is gravitational contraction. If a massive body gets smaller, it releases gravitational potential energy, in this case in the form of heat.
The gravitational potential energy is given by the integral over
 (6) 
for masses m and m¢ separated by a distance r.
For a spherical body, such as a star, one finds (to within a small constant)
 (7) 
For the Sun, this is W_{O} = 4 ×10^{48} erg.
Suppose now that the Sun is collapsing slowly in order to generate its luminosity. How long would it be able to shine? This time scale is called the KelvinHelmholtz timescale, t_{KH}.
The solar luminosity is L_{O} = 3.86 ×10^{33} erg/sec, hence the Sun can shine at this rate by converting potential energy for
 (8) 
This is quite a long time, and in the middle of the 19th century, when it was first derived, it was considered to be the best estimate for the age of the Sun. Late in the 19th century and early in the 20th, the age of the Earth became much better understood than the age of the Sun, with geological evidence and radioactivity indicating that it is billions of years old. There was quite a conflict between the old and young age scales until the realisation that there is a third source of energy which is capable of sustaining the stars, nuclear energy.
The amount of energy in the Sun in its rest mass, M_{O}, is given by
 (9) 
The Einstein time scale, t_{E}, is then
 (10) 
Here we assume that all the rest mass energy is converted into radiation  i.e. the Sun radiates and finally disappears when it is finished burning!
Detailed analysis reveals that the Sun will be about 0.1% efficient in converting its mass into radiant energy, and the lifetime for a star like the Sun is therefore reduced by this factor to circa 10^{10} years, or about the present age of the Universe.
Consider a small mass element at a distance r from the center of a spherical body, with density r, area A and thickness dr (see Figure 3.1). The gravitational force inward on the mass element is given by
 (11) 
where M(r) is the mass of the body inside radius r.
The pressure force outward on the mass element is related to the difference between the pressure on the upper surface of the mass element and the lower surface. We denote this pressure difference dP.
 (12) 
For a star in mechanical equilibrium, these forces balance, so that
 (13) 
Problem 3.4 Use the above equations to show that
This important relation is called the equation of hydrostatic equilibrium.

We can use this equation to derive first order estimates of the temperature and pressure at the center of the Sun.
To first order, we can consider dP/dr as the pressure difference between the edge and the center of the sun. From Eqn 3.14, we have
 (15) 
using the mean density of the sun, r = M_{O}/((4 p/3)R_{O}^{3}), and assuming that the central pressure is much greater than the surface pressure, we get
 (16) 
or about 5 ×10^{9} atmospheres. Obviously the above approximation was very rough, and a careful analysis shows that it is about two orders of magnitude too small. However, it is not a too bad first approximation.
We now have an estimate of the central pressure, and assuming that the material at the center is a still a gas, we can relate this pressure to the temperature, T, and the Boltzmann constant k via the equation of state for an ideal gas:
 (17) 
where N is the number density of particles.
Problem 3.5 Assume the Sun is a uniform sphere made of protons, and use the mass of the sun and the mass of the proton to estimate N, the number density of particles. Hence show that the central temperature of the Sun is about 20 ×10^{6} K.

A detailed analysis shows that the central solar temperature is about 15×10^{6} K, so this simple estimate is not too bad.
Consider the equation of Hydrostatic equilibrium in terms of the mean density r of a spherical shell within a spherically symmetric star.
 (18) 
Here P(r) is the pressure as a function of radius, r; m(r) is the mass inside radius r, and G is the gravitational constant (see Figure 3.2). The mass of the shell dm, is given by its area, thickness dr and density r
 (19) 
The two equations above can be combined to give
 (20) 
where the radius is now treated as a function of the interior mass, r = r(m). This equation can be integrated to derive a result for the maximum central density of the star, by considering the quantity P¢
 (21) 
Problem 3.6 Differentiate P¢ with respect to r, and using the equation of hydrostatic equilibrium, show that [(dP¢)/dr] < 0 for all r.

The problem above shows that [(dP¢)/dr] is always negative going outward from the center of the star, so it follows that P¢ always decreases going outward. At the center of the star, the second term in the quantity P¢ approaches 0, and hence P¢ approaches the central pressure P_{cen}. It follows that
 (22) 
This sets a lower limit to the central pressure in a star.
Problem 3.7 What is the value of the lower limit for the central pressure in the Sun?

We cannot integrate the equation of hydrostatic equilibrium to derive the behaviour of temperature, density, pressure etc without further assumptions about the physics of energy production and the manner in which it is transfered to the surface. However, several instructive ``toy models'' can be developed which give an idea of the kind of behaviour we can expect. We will look at two such models, the linear stellar model and (later) the socalled polytropes.
In the first of these models the density of the star takes an arbitrarily assumed form, which decreases linearly from the center to the surface.
 (23) 
In the second model a simple form for the pressure as a function of the density is adopted
 (24) 
where K and g are constants.
Assuming that the density in a star varies linearly with radius as
 (25) 
we use the equation of hydrostatic equilibrium to derive
 (26) 
From Eqn 3.19 the mass varies with the radius as
 (27) 
Integrating we get
 (28) 
We can normalise the equation to the total mass, M, by noting that at r=R,
 (29) 
Substituting for r_{cen}, we derive
 (30) 
Inserting this result into the equation of hydrostatic equilibrium (Eqn 3.26), we derive
 (31) 
Problem 3.8 Integrate the equation above to derive the pressure as a function of radius, P(r).
Hint: assume that the pressure at the surface of the star is P(R)=0.

Substituting for the central density r_{cen} (from Eqn 3.29), we derive
 (33) 
One can derive the temperature profile in the star by substituting the equation of state for an ideal gas, T = mm_{H} P/rk, where m_{H} is the proton mass and k is the Boltzmann constant, and m is the mean molecular weight, (N.B. this assumes that the only pressure term is due to the gas pressure  i.e. the photon pressure is ignored).
Problem 3.9 Verify that the temperature is given by

A specific instance of the linear model is one in which the density is constant  i.e. there is no gradient in the density
 (35) 
We can use this model to rederive our results in the previous section for the central pressure and central temperature. We have:
 (36) 
and
 (37) 
substituting for m(r) into Eqn 3.36 and integrating (using the boundary condition that P=0 at the surface of the star r=R) we obtain as a constant of the integration the central pressure
 (38) 
and since the density is constant, the mean density is the same as the central density
 (39) 
and so we derive a central pressure of
 (40) 
The pressure as a function of the radius is given by
 (41) 
Problem 3.10 Prove Eqns. 3.39 and 3.41

In class you'll get a floppy disk containing the public domain program GNUPLOT,
published by the Gnu Foundation.
A good site for help with gnuplot is at
http://www.cs.uni.edu/Help/gnuplot/.
You can get the windows version of the program from
http://www.astro.utu.fi/~cflynn/Stars/gnuplot3_7cyg.zip.
Here is a quick guide to doing some basic things. Start gnuplot by clicking on
the icon or typing gnuplot.
To plot out a simple function:
gnuplot> plot sin(x)
to plot with some parameters set:
gnuplot> plot f(x) = sin(x*a), a = 0.2, f(x)
to plot with x and y axis limits
gnuplot> plot [t=1:10] [pi:pi*2] tan(t)
set range of Xaxis
gnuplot> set xrange [1:10]
set range of Yaxis
gnuplot> set yrange [pi:pi]
plot out a parabola
gnuplot> set xrange[10:10] gnuplot> f(x) = x**2 gnuplot> plot f(x)
plot data from a file
gnuplot> plot 'fig5.dat'
define a 2D function
gnuplot> f(x,y) = x**2+y**2
plot a 2D function
gnuplot> splot f(x,y)
same with ranges set
gnuplot> splot [x=5:5] [y=5:5] [0:200] f(x,y)
define Xaxis label
gnuplot> set xlabel "radius [r/R]"
define Yaxis label
gnuplot> set xlabel "temperature [T/Tc]"
Example input file (e.g. ``linear.gp''):
t(x) = 1.0 + x  (19.0/5.0)*x**2 + (9.0/5.0)*x**3 m(x) = 4.0*x**3  3.0*x**4
read commands from this file
gnuplot> load "linear.gp"
plot several functions
gnuplot> plot t(x),m(x)
Problem 3.11 Use Gnuplot to plot the temperature, density and pressure relative to their central values as a function of radius for the linear and constant density stellar models. Use R=1 for the radius of the star.

Continuing from the last section, where we derived basic results for the linear stellar model, we will look this week at a practical example of programming to solve the model for the specific case of the Sun.
We would like to determine the pressure, P(r), and temperature, T(r) profiles for the Sun in this model as a function of radius, r:
 (42) 
 (43) 
From these expressions it is easy to see that the central pressure and central temperature (at r=0) are given by
 (44) 
and
 (45) 
The density r(r) falls linearly with radius and is given by
 (46) 
where the central density can be found from (Eqn 3.29)
 (47) 
i.e. for the Sun
 (48) 
Here is a listing of the Gnuplot commands needed to plot the temperature as a function of radius in the Sun. The physical quantities needed for a linear model of the Sun are listed in Table 3.1.
# first, define the values of constants gnuplot> G = 6.67259E8 gnuplot> Msun = 1.99E+33 gnuplot> Rsun = 6.96E10 gnuplot> mu = 0.6 gnuplot> mp = 1.672631E24 gnuplot> k = 1.380658E16 # now compute central values of P, T and rho gnuplot> P0 = (5.0*G*Msun**2)/(4.0*pi*Rsun**4) gnuplot> rho0 = 3.0*Msun/(pi*Rsun**3) gnuplot> T0 = (5.0*pi*G*mu*mp*rho0*Rsun**2)/(36.0*k) # Print out the results gnuplot> print "Central Pressure = ", P0 gnuplot> print "Central Temperature = ", T0 gnuplot> print "Central Density = ",rho0 # Plot the temperature profile, T gnuplot> t(x) = T0*(1.0 + x (19.0/5.0)*x**2 + (9.0/5.0)*x**3) gnuplot> plot [0:1] t(x)
G  6.67259 ×10^{8}  Grav. const. (cm^{3} g^{1} sec^{2}) 
k  1.380658 ×10^{16}  Boltzmann constant (erg K^{1}) 
m_{p}  1.672631 ×10^{24}  Mass of a proton (g) 
m  0.6  Mean molecular weight 
M_{O}  1.99 ×10^{33}  Solar mass (g) 
R_{O}  6.96 ×10^{10}  Solar radius (cm) 
Problem 3.12 Use Gnuplot to plot the temperature, density and pressure profiles as a function of radius for this model of the Sun.
