Using MESA

Modules for Experiments in Stellar Astrophysics, 1D stellar evolution code

Table of Contents

1 Setup

1.1 Install the MESA SDK

Navigate to the MESA SDK website and carefully follow the instructions there. Read the page closely and watch out not to forget to install the prerequisites appropriate for your system.

1.2 Download MESA

MESA is an open-source code. The following command will download the latest release version into a directory named mesa. The package is large, so make sure you have ~ 10 GB free on your disk and don't worry if it takes a little while to download.

svn co -r 8845 http://mesa.svn.sourceforge.net/svnroot/mesa/trunk mesa

1.3 Edit your shell start-up files

The easiest way to make sure that your system is always configured appropriately is to add the needed commands to the appropriate shell start-up file. As an example, the following lines are included in .bashrc. If you use .cshrc the commands are slightly different.

# set up mesa
export MESA_DIR=/Users/name/mesa
export MESASDK_ROOT=/Applications/mesasdk

# initialize MESA SDK
source $MESASDK_ROOT/bin/mesasdk_init.sh

# this is for a dual core machine
export OMP_NUM_THREADS=2

1.4 Compile MESA

Now we are ready to compile the code. This will take a little while, so do something else for a bit.

cd $MESA_DIR
./install

2 Running MESA

2.1 Make a work directory

You may want to perform and store our work somewhere other than the main MESA directory. MESA helps make this easy by providing a template project directory. Each time you want to start a new MESA project, make a new copy of this directory.

cp -r $MESA_DIR/star/work projectname

2.2 Compile

Now that we have a work directory, we need to compile the code that lives in it.

cd projectname
./mk

2.3 Edit configuration files

Eliot Quataert has provided a set of simple configuration files that you should download and put in your work directory. While you don't need to understand every line, you should understand each file's general purpose. Take a look at the files and the corresponding descriptions below.

  • inlist
    This is the master configuration file that MESA reads when it stars up. There are three sections: star_job, which has options for the routines that "drive" the code, controls, which has the options for the star program, and pgstar, which has options for on-screen plotting.

    The file given tells MESA to go look elsewhere for the configuration info. This makes changing between different inlists easier, by allowing you to change the name of the file that gets read.

  • inlist_solar_mass_zams
    These are the options that we'll use to construct a solar-mass star from a pre-main sequence model and then stop the evolution once we reach the zero-age main sequence (ZAMS).
  • inlist_pgstar
    This houses the options for on-screen plotting. Feel free to ignore it for now. As written, it produces a simple HR diagram with a box marking the location of our Sun.
  • history_columns.list
    The history file records quantities that are defined at each timestep, like the luminosity or the effective temperature. This file lets you choose which quantities will be logged.
  • profile_columns.list
    A profile file records quantities that are defined over the whole star at single timestep, like the pressure or density. This file lets you choose which quantities are logged.

2.4 Run MESA

Running the code is now as simple as typing

./rn

MESA will keep you updated via terminal output and the pgstar on-screen plotting.

3 Analyzing Data

The data files are text-based and can fed into your favorite plotting program. You can write your own routine to read them or visit the MESA Forum and see if someone has contributed code in your language of choice.

By default, MESA stores its data in the ./LOGS directory. In there, you'll find the following files.

3.1 history.data

This is a log of the history quantities that you requested.

3.2 profiles.index

MESA doesn't store profiles for every step (that'd take up too much space). This list tells you how to translate between the numbers in the profile filenames and the MESA model numbers. By default, MESA will store a profile at the end of the run.

3.3 profile<n>.data

This is a log of the stellar profile quantities that you requested at a single timestep. For convenience, the top of the file contains some useful global quantities at that step.

4 Resources

Here are links to some other MESA resources you might find interesting. The website and user forum have some support information. The MESA papers are a good way to get a feel for the variety of questions one can use MESA to study.