% !TEX TS-program = pdflatexmk 

\documentclass[preprint,12pt]{aastex}
\usepackage{natbib}
\citestyle{aa}
\usepackage{graphics}
\usepackage[colorlinks=true]{hyperref}
\usepackage{pdfsync}

\usepackage{geometry}
\geometry{letterpaper}   
\usepackage{amsmath}

\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}

\usepackage[colorlinks=true]{hyperref}

%% MATHY SYMBOLS
\newcommand{\p}{\partial}
\newcommand{\nab}{\vc{\nabla}}
\newcommand{\xv}{\vc{x}}
\newcommand{\kv}{\vc{k}}
\newcommand{\brak}[1]{\langle #1\rangle} %put in brackets
\newcommand{\vcs}[1]{\mbox{\boldmath{$\scriptstyle{#1}$}}}
\newcommand{\vc}[1]{\mbox{\boldmath{$#1$}}}
\DeclareMathSymbol{\varOmega}{\mathord}{letters}{"0A}
\DeclareMathSymbol{\varSigma}{\mathord}{letters}{"06}
\DeclareMathSymbol{\varPsi}{\mathord}{letters}{"09}
\def \mesa {\texttt{MESA\,}}

\pagestyle{empty}


\title{Astronomy : Homework  2\\
\normalsize Due: Thursday  Sept. 26, 2019}

\begin{document}
\maketitle

\begin{enumerate}
\item {\bf Monatomic and Diatomic Ideal Gases}\\
Show that  $$\nabla_{\rm ad}  = \mathbb{R}/C_P$$ for an ideal gas,  where $\mathbb{R} = k_B/(\mu m_u)$ is the \emph{specific} gas constant.  Start with the first law of thermodynamics and $C_V \equiv \partial Q /\partial T|_\rho$.  (Hint: also $C_V = \partial U/\partial T|_\rho$ for internal energy $U$.  Why?)  (Hint 2: Along the way you should show that $C_P = C_v + \mathbb{R}$.)  Use the number of degrees of freedom for a monatomic and diatomic ideal gas to derive $\nabla_{\rm ad}$ for these two cases (relevant for many stars and planets/disks, respectively).

\item {\bf Radiative vs. Convective Envelopes}\\
Whether stars develop an outer convective zone depends significantly on the opacity.  We will show this for an idealized, but reasonably realistic problem.  Assume a powerlaw opacity of the form
$$\kappa = \kappa_0 (P/P_o)^a (T/T_o)^b$$
where $T_o$ and $P_o$ hold at the photosphere.  Assume a radiative structure with  $l/m$ (luminosity to enclosed mass)  constant.   Assume that $b < 4$ and $a > -1$ (a simplification).
\begin{enumerate}
\item Solve for   $T$ as a function of $P$ by integrating inwards from the photosphere.
\item Take the limit $T \gg T_o$, $P \gg P_o$ to find $\nabla = d \ln T/d\ln P$ in the deep interior.  Call this limit $\nabla_\infty$ which depends only on $a$ and $b$.

\item Check whether the assumption of a radiative interior holds for three cases: (i)   An electron scattering opacity ($a = b= 0$); (ii) bound-free and free-free opacities ($a = 1$, $b = -4.5$); (iii) a H$^-$ opacity with $a = 1$, $b = 3$.  For the assumption of a monatomic ideal gas, will each case be radiative or convective in the deep interior?  ((Describe whether this result is realistic based on your understanding of stars both Sun-like and more massive than the Sun. (We will later learn that these simple results are reasonably accurate for real stars that have these respective opacities!)

\item \emph{Bonus}: Define the photospheric temperature gradient, $\nabla_o \equiv d \ln T/d \ln P |_{(T_o, P_o)}$.  Show that the case $\nabla_o < \nabla_{\rm ad} < \nabla_\infty$ becomes convective at pressures greater than
$$\left(\frac{P}{P_o} \right)^{1+a}= \frac{\nabla_o^{-1} - \nabla_\infty^{-1}}{\nabla_{\rm ad}^{-1} - \nabla_\infty^{-1}} \; .$$
\end{enumerate} 

\item {\bf Convection, to order of magnitude}

Using formulae in  textbooks for $F_{\rm con}$ and $v$, the convective flux and velocity, show that to order of magniture 
$$F_{\rm con} \sim \rho v^3$$
Ignore all order unity constants and assume an ideal gas.  Show your steps!


\item {\bf \mesa Analysis} \\
For this problem, please turn the plots and interpretation in with your HW.  The code to generate (notebook and/or scripts) should be submitted by email.  This problem will continue to analyze the $M_{\rm initial} = 15 M_\odot$ \texttt{MESA} tutorial problem from ``getting started".  \\
Note: when  restarting from the TAMS model, \mesa seems to  (i.e.\ it did for me) overwrite the \texttt{LOGS/history.data} file.  To recover the earlier history you will  need to re-run the earlier part, before the TAMS  (i.e. go back to using \texttt{inlist\_project}, and also note that if you re-run there's no need to stop and re-start at the ZAMS).  Also before re-running be sure to protect (e.g. rename/move) the existing LOGS folder so you don't just overwrite the history data again!  
\begin{enumerate}
\item Plot the ratio $t_{\rm KH}/t_{\rm age}$ vs $t_\mathrm{age}$, where $t_{\rm age}$ is the age of the star, and $t_{\rm KH}$ is the order-of-magnitude estimate of the Kelvin-Helmholtz timescale, using available history data.  Make this a log-log plot for $t_{\rm age}/ \text{year} > 10$.  \\
Argue why data from before $\sim 10^3$ or $10^4$ years is probably unreliable.  Pick a time in this range (which may depend on your choice of order unity constant for $t_{\rm KH}$) before which the model is unreliable.
\item Plot a HR diagram of the evolution, starting after the time you find above (i.e. pruning data).  Indicate time somehow, either with a color-varying line and colorbar or by labelling the time at a few (say at least 4) points.
\item At what age does Hydrogen burning become significant?  (A plot is probably the easiest way to support your answer.)  Based on this analysis, do massive stars have significant pre-main-sequence lifetimes?
\item Focusing now on the late stage evolution, plot the  total luminosity from 10 Myr to the end of the simulation.  Overplot  the three types of nuclear burning given in the history: $L_{\rm H}$, $L_{\rm He}$ and $L_Z$ (everything else) as well as $L_{\rm nuc}$, the sum of these nuclear luminosities.  What did \mesa output to the terminal when the run ended?  (You may beed to run the second half again to see, being careful about your history files...)  Why do you think the run ended this way?
\item Now plot the difference between total $L$ and $L_{\rm nuc}$  (again for age $>10$ Myr). To better see both large positive and negative numbers, plot $\log(L - L_{\rm nuc})$ and $\log(L_{\rm nuc} - L)$ in different line styles.  Explain how it is possible to have $L \neq L_{\rm nuc}$.  Include a plot of log stellar radius over the same time to aid this explanation.

\end{enumerate} 

\end{enumerate}

\end{document}