% Stellar Structure and Evolution
% Computer exercises
% Michelle Mizuno-Wiedner, Fall 2002

\documentclass[a4paper,twoside,12pt]{article}
\setlength{\textheight}{24cm}
\setlength{\textwidth}{14cm}
\setlength{\topmargin}{-15mm}
\setlength{\oddsidemargin}{1cm}
\setlength{\evensidemargin}{-0.5cm}
\setlength{\parindent}{0cm}
\setlength{\parskip}{3mm}

\begin{document}

\begin{center}
  \huge{\bf Stellar Structure Modelling} \\[3mm]
  \large{\bf{Computer exercises for the course in \\
             Stellar Structure and Evolution, Fall 2002}} \\[3mm]
  Lab report due: Thursday, 17 October 2002
\end{center}


\section{Introduction}

In this computer exercise, you will generate models of stars on the
zero-age main sequence (ZAMS) in order to examine and compare their
properties. The computer program that you will be using to create the
models is called {\tt zams.f} and comes from the book \textsl{Stellar
Interiors} by C.~J.~Hansen and S.~D.~Kawaler. It is worth reading
chapter~2.2 of this book, ``Single Stars On and Near the Main
Sequence,'' to get an overview for this project. You can also read a
bit more about the computer code itself in Appendix~C. Finally, if you
are interested in more details of stellar modelling (which however are
not required), chapter~7 of the book contains information about the
numerical methods used to produce such models.

\section {Getting started}

Copy the program's source code from the lab directory into your own
working directory (named, for example, ZAMS). You can do this with
UNIX commands, e.g.:
%
\begin{verse}
\texttt{%
mkdir ZAMS \\
cd ZAMS \\
cp\,\, /u1/local/lab/stjarnstruktur/zams/zams.f~\,zams.f
}
\end{verse}
%
Then compile the Fortran~77 program:
%
\begin{verse}
\texttt{%
f77 -o zams zams.f
}
\end{verse}
%
This will give you an executable file called \texttt{zams}, which you
run by simply typing its name.

The program will ask you for the stellar mass and the hydrogen and
helium content, as well as your guesses for the central pressure and
temperature, the total radius and the total luminosity. (Do not bother
about having a pulsation output.) The text files
\texttt{modin.001} and \texttt{modin.015} in the lab directory show
examples of the screen input, where numbers like \texttt{6.93e10} are
entered in exponential notation.
%Sample output is given in
%\texttt{modout.001} and \texttt{modout.015}

Note that your initial guesses should not lie ``too far'' off from the
solution, or else the numerical algorithm will not converge and you
will get a message complaining about the equation of state (EOS). In
that case, you will have to think about how to make better guesses for
the starting values. If your guesses are better but not quite good
enough for the program to converge within 15 iterations, try changing
the value of \texttt{NTRY=15} on line~128 of the source code to
something larger, recompiling and running the program again.

The generated output file (with whatever name you gave it) will
include information such as the following:
\\
\\
                   *****FINAL MODEL*****\\
P$_c$: 1.4820D+17,\\
T$_c$: 1.4419D+07,\\
R: 6.9321D+10, \\
L: 3.4942D+33\\
T$_{eff}$:  5.6522D+03,\\
log(T$_{eff}$): 3.7522, \\
log(L/L$_\odot$): -.0418
%
\begin{center}
***************************************\\
\end{center}
%
\begin{tabular}{c c c c c c c c} 
depth point & ${\rm 1-{\cal M}_r/{\cal M}}$ &  log(r) & log(P) & log(T) & log($\rho$) & log(${\cal L}_r$) \\ \hline
    2 &  9.98776351D-01 & 9.28096 & 17.1603 & 7.1551 & 1.9145 & 31.6380 \\
    3 &  9.97511452D-01 & 9.38525 & 17.1539 & 7.1528 & 1.9104 & 31.9306 \\
    4 &  9.96203968D-01 & 9.44732 & 17.1483 & 7.1507 & 1.9068 & 32.1041 \\
    5 &  9.94852527D-01 & 9.49218 & 17.1432 & 7.1489 & 1.9035 & 32.2283 \\
    6 &  9.93455716D-01 & 9.52763 & 17.1383 & 7.1471 & 1.9004 & 32.3255 \\
    7 &  9.92012082D-01 & 9.55714 & 17.1336 & 7.1454 & 1.8973 & 32.4054 \\
    8 &  9.90520130D-01 & 9.58255 & 17.1290 & 7.1438 & 1.8943 & 32.4735 \\
    9 &  9.88978322D-01 & 9.60498 & 17.1245 & 7.1422 & 1.8913 & 32.5329 \\
   10 &  9.87385079D-01 & 9.62512 & 17.1200 & 7.1406 & 1.8884 & 32.5856 \\
   $\cdots$ & & & & &  & & 
\end{tabular}\\
 \\


\begin{tabular}{c c c c c c c c} 
depth point  & log($\epsilon$) & log($\kappa$) & log(${\rm {\cal L}_r(conv)}$) & $\frac{
{\cal L}_{\rm r}{\rm (conv)}}{{\cal L}_{\rm r}{\rm (tot)}
}$ & $\nabla$ & $\nabla_{ad}$ & $\nabla_{rad}$ \\ \hline
  2 & 1.2278 & .1844 & .0000 & .0000 & .37297 & .39887 & .3730 \\
  3 & 1.2131 & .1885 & .0000 & .0000 & .36572 & .39887 & .3657 \\
  4 & 1.2006 & .1920 & .0000 & .0000 & .36252 & .39888 & .3625 \\
  5 & 1.1891 & .1952 & .0000 & .0000 & .36040 & .39888 & .3604 \\
  6 & 1.1783 & .1982 & .0000 & .0000 & .35874 & .39888 & .3587 \\
  7 & 1.1678 & .2010 & .0000 & .0000 & .35733 & .39888 & .3573 \\
  8 & 1.1577 & .2038 & .0000 & .0000 & .35607 & .39889 & .3561 \\
  9 & 1.1478 & .2065 & .0000 & .0000 & .35490 & .39889 & .3549 \\   
 10 & 1.1380 & .2092 & .0000 & .0000 & .35380 & .39889 & .3538 \\
 $\cdots$ & & & & &  & & 

\end{tabular}


\section {Questions to consider}

The idea is to use this lab to explore and get an overview of the
properties of main-sequence stars. Below are some questions for you to 
consider.

\begin{enumerate}
\item Read the description in chapter 2.2 of Hansen and Kawaler
      about the stellar modelling code.
      What approximations have been made and what would be needed to
      get more realistic models? What is the range of applicability of
      the models, i.e., in what range are the models reasonably
      realistic and when should you be a bit skeptical of the model
      output?
\item Generate a series of models with solar composition. (Later, in
      order to compare the effects of chemical composition, do the
      same for models of more metal-rich or metal-poor stars, in which
      you will have to decide on reasonable values for the metallicity
      $Z$. Note that in order to do exercise~\ref{item:chemical}
      below, it is important to choose the same stellar masses in each
      case.)
\item To get converged models, experiment with making initial
      estimates that are close enough to produce convergent stellar
      models. Produce models for at least three stars of different
      masses. Report what kinds of methods and assumptions you tried,
      what difficulties you may have had, and how you managed to find
      good initial guesses. Be detailed in explaining the calculations
      and approximations you made.
\item For a given chemical composition, choose three stars of
      different masses and investigate the different quantities such
      as mass, radius, density, pressure and temperature as functions
      of radius and of mass. Plot the quantities so that the
      structural differences between the stars can be compared easily
      at a glance.
\item Again for  a given chemical composition, examine the different
      temperature gradients and explain how to identify the convective
      zones in your models. Use plots to get an overview of the
      different extent of convective zones in models of different
      masses, and discuss the reasons for those differences.
\item \label{item:mass}
      Again looking at models of the same chemical composition,
      compare how the following quantities change according to the
      mass of the star: central temperature, central density, central
      energy generation rate, and effective temperature. Interpret
      these results!
\item Use fits
      to determine the mass-radius and mass-luminosity relations
      (i.e., how the total stellar radius and the total luminosity
      depend on the total stellar mass).
\item \label{item:chemical}
      Now study the effect of chemical composition by comparing the
      models with different chemical composition. For a given
      mass, which chemical composition has the largest central
      temperature?  the largest central density? the largest energy
      generation rate at the center? Explain why this is so!
\item Use your data to plot the zero-age main sequence in the
      traditional $\log \mathcal{L}$-$\log T_{\rm eff}$ diagram. How
      does the ZAMS differ for stars of different chemical
      compositions? How do you account for the differences in
      effective temperature and luminosity between two models of the
      same mass but different chemical composition?
\end{enumerate}


\section {Report}

Present your results in a written report that describes what you have
been investigating and the results you achieved, both in text and
pictures. Please think about the best way to plot interesting
quantities in a limited number of diagrams.

In addition to whatever programs you may already be using, the
computer system at the Observatory has a number of tools for your
use. For those of you who would like to write your report in the
typesetting language \LaTeX, which is widely used by astronomers, you
may use the computer file \texttt{ZAMS\_lab.tex} with these
instructions as a template. Very nice plots can be produced using IDL
(Interactive Data Language). You can learn more about both of these
tools by following the links on
%
\begin{verse}
\texttt{http://www.astro.uu.se/$\sim$mizuno/Teaching/}
\end{verse}
%
The lab directory \texttt{/u1/local/lab/stjarnstruktur/zams} contains
the IDL routine \texttt{readzams.pro} to help you read model output
into IDL arrays, as well as \texttt{ps\_open.pro} and
\texttt{ps\_close.pro} to produce Postscript output. If you have any
problems, Michelle is in the office until October~11 and can offer
some help with IDL and the other tools.

Finally, if you have comments about how to improve this laboratory
exercise, they are very welcome!


\vfill

{\footnotesize
\noindent
The software for this exercise was developed by C.~J.~Hansen and
S.~D.~Kawaler, in \textsl{Stellar Interiors: Physical Principles,
Structure and Evolution}, Springer-Verlag, 1994. This computer
exercise is the version by Michelle Mizuno, October 2002, based on the
one written by Nils Ryde on September~15,~1997.}

\end {document}

