University of Wisconsin-Madison
Topics in Computing for Astronomy — Oct 30 2012
Rich Townsend
log Density (g cm�3)
log
Tem
pera
ture
(K)
OPAL
SCVH
PC
HELM
HELM
e�e+
oxygen� =
175
0.001M�
0.8M� WD1.0M�25M�
�10 �8 �6 �4 �2 0 2 4 6 82
3
4
5
6
7
8
9
10
The MESA Stellar Evolution Code
Tuesday, October 30, 12
Modules for Experiments in Stellar Astrophysics
Tuesday, October 30, 12
Why a New Stellar Evolution Code?• Openness: anyone can download sources from the website.
• Modularity: independent modules for physics and for numerical algorithms; the parts can be used stand-alone.
• Comprehensive Microphysics: up-to-date, wide-ranging, flexible, and independently useable microphysics modules.
• Modern Techniques: advanced AMR, fully coupled solution for composition and abundances, mass loss and gain, etc.
• Performance: runs well on a personal computer and makes effective use of parallelism with multi-core architectures.
• Wide Applicability: capable of calculating the evolution of stars in a wide range of environments.
Tuesday, October 30, 12
The MESA Council
• Members:• Lars Bildsten (UCSB/KITP)• Bill Paxton (UCSB/KITP)• Frank Timmes (Arizona State)• Falk Herwig (University of British Columbia)• Ed Brown (Michigan State)• Aaron Dotter (STScI; now Oz)• Matteo Cantiello (UCSB/KITP)• Rich Townsend (University of Wisconsin-Madison)
• Duties• Code development• Instrument paper(s)• Infrastructure maintenance (website, forum, SDK)• Summer schools
Tuesday, October 30, 12
Online MESA Resources• Website (main resource):
• Mailing list (bug reports, results):
• Forum (bug reports, results, lectures, FAQs):
• SDK (software tools):
• Instrument paper:
https://lists.sourceforge.net/lists/listinfo/MESA-users
http://mesa.sourceforge.net/index.html
http://mesastar.org/
http://www.astro.wisc.edu/~townsend/static.php?ref=mesasdk
http://adsabs.harvard.edu/abs/2011ApJS..192....3P
Tuesday, October 30, 12
●
●
●
●
●
●
●●
●
ZAMS
log T
e↵ (K)
lo
gL/L�
0.9
Y = 0.28
Z = 0.02
1.2
1.5
2.0
3.53.63.73.83.9
0
12
3
4
✏F/kT=4
✏F/kT=20
log P=20.25
log ⇢c
(g cm
�3
)
lo
gT
c(K
)
0.91.2
1.52.0
1 2 3 4 5 6
7.0
7.5
8.0
MESA in Action: Low-Mass Stellar Evolution
• Code goes through He core flash without problems
• No need for ad-hoc ‘transition’ between RGB and HB (i.e., no EZ-Web fudge)
• Thermal pulses on AGB also handled
• Mass-loss allows evolution through to WD remnant
From MESA Instrument PaperTuesday, October 30, 12
MESA in Action: Intermediate-Mass Stars
log T
e↵
log
L/L�
3.423.443.463.483.503.523.543.56
3.4
3.6
3.8
4.0
✏F/kT=30
log ⇢c
(g cm
�3
)
log
T
c
(K
)
6.1 6.2 6.3 6.4
7.8
6
7.8
97.9
2
7.9
5
● ●
●
●
●
●
●●
●
●●●●●
●●●
ZAMS
log T
e↵ (K)
lo
gL
(L
�)
2
3
4
5
6
7
8
10
3.63.84.04.24.4
12
3
4
✏F/kT=4
Y = 0.28
Z = 0.02
log ⇢c
(g cm
�3
)
lo
gT
c(K
)
2
2
3
3
4
4
5
5
6
6
7
7
8
8
10
10
0 1 2 3 4 5 6 7
7.0
7.5
8.0
8.5
9.0
From MESA Instrument PaperTuesday, October 30, 12
MESA in Action: Massive Stars to Core Collapse
Tc / ⇢1/3c
MESAKEPLERHMMLC06
Mi = 25M�Zi = 0.02
He burn
C burn
Ne burn
O burn
Si burn
log ⇢c (g cm�3)
log
T c(K
)
3 4 5 6 7 8 9
8.5
9.0
9.5
10.0
m (M�)
log
mas
sfr
actio
n
4He 4He
4He
4He
4He
12C
16O
16O16O
20Ne
20Ne
24Mg
24Mg
28Si
28Si28Si
28Si
28Si
28Si
32S
32S32S
32S
32S
36Ar36Ar
36Ar
40Ca40Ca
40Ca
54Fe54Fe
54Fe
54Fe54Fe
56Fe56Fe 56Fe
56Fe 56Fe
56Fe 56Fe
56Ni56Ni
“56Cr”“56Cr”
“56Cr”
“56Cr”
“56Cr”
neutneut
M0 = 25M�Z0 = 0.02
0.5 1.0 1.5 2.0 2.5
�3�2
�10
From MESA Instrument PaperTuesday, October 30, 12
MESA in Action: Brown Dwarfs & Giant Planets
■●▲
■
●
▲
■
●
▲
■
●
▲
■
●
▲
■
●
▲
■
●
▲
■
●
■
●
■
●
■
●
■
●
■■■■■ ■ ■
■■
■
✏F
/kT=4
T
c
/ ⇢1/3c
10
30
100
300
1000
D Depletion
7
Li Depletion
ZAMS
Y = 0.275
Z = 0.019
log ⇢c
(g cm
�3
)
log
T
c
(K
)
0.3
0.2
0.15
0.12
0.1
0.09
0.08
0.075
0.07
0.065
0.06
0.055
0.05
0.045
0.04
0.035
0.03
0.025
0.02
0.017
0.014
0.012
0.011
0.01
0
1 2
3
5.5
6.0
6.5
7.0
From MESA Instrument PaperTuesday, October 30, 12
MESA in Action: Evolution of a Solar-Mass Star
Credit: Josiah Schwab
Tuesday, October 30, 12
MESA in Action: Evolution of a Solar-Mass Star
Credit: Josiah Schwab
Tuesday, October 30, 12
Installing MESA
• Obtain a current copy of the MESA tree:
• Set environment variables:
• Build MESA:
• Caveats:• Revision number is always changing; see http://mesa.sourceforge.net/getting_started.html• Takes up 4GB of disk space or more• Change OMP_NUM_THREADS to number of processor cores on your machine• Change syntax of environment-variable setting if you are using csh
svn co -r 4631 http://mesa.svn.sourceforge.net/svnroot/mesa/trunk mesa-4631
export OMP_NUM_THREADS=8export MESA_DIR=<blah>/mesa-4298
cd $MESA_DIR./install
Tuesday, October 30, 12
The MESA Software Development Kit (SDK)
• What’s it for?• Hassle-free compilation of MESA• Works on Linux and Mac OS X (Intel-based)
• What’s in it?• gcc/gfortran 4.7 compilers (good support for Fortran 2003)• BLAS/LAPACK libraries (linear algebra)• PGPLOT library (graphics)• HDF5 library (file storage)
• Where do I get it from?
• How do I install?• Linux: unpack tar archive (anywhere; don’t need to be root user)• OS X: drag package into Applications folder
http://www.astro.wisc.edu/~townsend/static.php?ref=mesasdk
Tuesday, October 30, 12
Running an Example: Solar-Mass Evolution
• Change into the example directory:
• Build the code:
• Run the code:
• Output produced in LOGS subdirectory:• history.data — global properties of all models in run• profileN.data (N=1,2,…) — internal structure of selected models• profiles.index — mapping between model number and N
cd $MESA_ROOT/star/test_suite/1M_pre_ms_to_wd/
./mk
./rn
Tuesday, October 30, 12
Modifying the Example: Enabling Plotting
• Edit the inlist_1.0 file:
• Run the code:
!pgstar_flag = .true.
pgstar_flag = .true.
./rn
Tuesday, October 30, 12
Understanding inlist Files• inlist format is defined by Fortran standard
• Overall file structure:
&star_job …/ ! end of star_job namelist
&controls …/ ! end of controls namelist
&pgstar …/ ! end of pgstar namelist
Overall run parameters
Detailed control parameters
Plot parameters
Tuesday, October 30, 12
Understanding inlist Files (cont.)&star_job
mesa_dir = '../../..'
read_extra_star_job_inlist1 = .true. extra_star_job_inlist1_name = 'inlist_sub'
/ ! end of star_job namelist
&controls initial_mass = 1.0 initial_z = 0.02d0
/ ! end of controls namelist
…
Path to $MESA_DIR dir
Read subsidiary inlist
Mass & metallicity
Tuesday, October 30, 12
• Grab the read_mesa.pro IDL procedure :
• Read data into IDL structures:
Reading MESA Output Files
IDL> s = read_mesa(‘profile1.data’)IDL> help, s, /strIDL> plot, s.logrho, s.logT
http://mesastar.org/tools-utilities/idl
IDL> s = read_mesa(‘history.data’)IDL> help, s, /strIDL> plot, s.log_Teff, s.log_L, xrange=[4.5,3.5], yrange=[0,4]
Tuesday, October 30, 12
Other test_suite Examples
• sample_zams — build multiple ZAMS models
• 7M_prems_to_AGB – 7 M☉, pre-main sequence to AGB
• example_astero — asteroseismology using adipls code (supplied)
• binary_rlo — Roche-lobe overflow in binary system
• 1.5M_with_diffusion – 1.5 M☉, elemental diffusion
• massive_rotating – 15 M☉, initial rotation at 50% critical
• ns_c – 1 M☉ neutron star, accreting/burning carbon
Tuesday, October 30, 12
Rolling Your Own• Copy one of the test_suite directories:
• Delete the MESA_DIR definition from my_project/make/makefile (this will cause MESA to pick up the definition from the MESA_DIR environment variable)
• Delete the mesa_dir definition from the inlist (this will cause MESA to pick up the definition from the MESA_DIR environment variable)
• Edit the inlist(s)• Edit source files in my_project/src• Clean, make and run:
cp -a $MESA_DIR/star/test_suite/1M_pre_ms_to_wd my_project
cd my_project; ./clean; ./mk; ./rn
Tuesday, October 30, 12