\( \newcommand{\PD}[2]{\frac{\partial#1}{\partial#2}} \renewcommand{\vec}[1]{\mathbf{#1}} \newcommand{\ord}{\mathcal{O}} \newcommand{\Mr}{M_\text{r}} \newcommand{\msol}{M_{\odot}} \newcommand{\rsol}{R_{\odot}} \newcommand{\nabad}{\nabla_\text{ad}} \newcommand{\HP}{H_P} \newcommand{\CFL}{\text{CFL}} \)
rates (nuclear reaction rates), eos (equation of state), mlt (mixing-length theory), kap (opacities), …star module is a full stellar evolution code./mk: compile (only needed once per directory)./rn: run code from initial conditionCtrl+c: interrupt code at any time./re x100: restart from a checkpointphotos directory for number)! is a comment (no effect on MESA)§ion_name and /.true. or .false.'a string'422.99792458d8pgstar_flag: show plot windows during simulationinitial_mass: zero age main sequence (ZAMS) mass (in $M_\odot$)initial_z: initial metallicityprofile_interval: frequency of output to profile filesprofile_columns_file: name of file with list of columns to include in profileTRho_Profile_win_flag: show window with $T$–$\rho$ profileHr_win_flag, Abundance_win_flag, …)$MESA_DIR/star/defaults/*.defaultsstar_H_mass_min_limit: stop when total hydrogen mass (in $M_\odot$) drops below this valuexa_central_lower_limit_species(1) = 'he4'
xa_central_lower_limit(1) = 0.25Lnuc_div_L_zams_limit = 0.99d0
stop_near_zams = .true.
LOGS directoryinlist filesless -S LOGS/filename.data
(-S prevents line wrapping)q
LOGS/history.dataPaxton et al. (2011)
numpymatplotlibipythonipython --pylab
x = linspace(0,5)
plot(x, exp(x), color='green')
xlabel('x')
ylabel('exp(x)')
yscale('log')
title('exponential')
savefig(…))numpy package[] can be used to extract sub-arraysx = arange(10)
x[5:7]
x[1:]
x[:-1]
x[1::2]
x[::-1]mesa.py is in the current directoryimport mesa
prof = mesa.profile('LOGS/profile22.data')
plot(prof.mass, prof.pressure)plot(prof.mass, prof.pressure)prof.columns # list of columns
prof.he4 # helium 4 mass fraction (array)
prof.star_age # stellar age in years (scalar)mesa_profile.m is in the current directory
prof = mesa_profile('LOGS/profile22.data')How do we find the derivative of a function given at fixed values $x_i$?