Skip to content

Running MESA star with the MESA SDK

This how-to discuss usage of Modules for Experiments in Stellar Astrophysics (MESA), an open-source 1D stellar evolution code, on Phoebe and Koios.

Download the MESA SDK into your home directory

The MESA SDK (compilers and libraries for MESA) is not installed centrally. Download it into your home directory; it needs no root access. Pick the SDK version that your MESA release asks for (see installing MESA); for MESA r22.05.1 it is 22.6.1:

cd ~
wget http://user.astro.wisc.edu/~townsend/resource/download/mesasdk/mesasdk-x86_64-linux-22.6.1.tar.gz
tar xzf mesasdk-x86_64-linux-22.6.1.tar.gz

This creates ~/mesasdk. Configure the environment variables for the MESA SDK:

export MESASDK_ROOT=$HOME/mesasdk
source $MESASDK_ROOT/bin/mesasdk_init.sh

Download and unpack MESA star, and configure the environment

Create a suitable directory in your homedir, navigate to it using the 'cd' command, download the Mesa Star zip file, and ununpack it in that directory

mkdir -p ~/projects/mesaStar
cd ~/projects/mesaStar
wget https://zenodo.org/records/6547951/files/mesa-r22.05.1.zip
unzip ./mesa-r22.05.1.zip

There in ~/projects/mesaStar , we should see unpacked archive:

[user@login1 mesaStar]$ ll 
total 2048836 
drwxrwxr-x. 34 jose jose         54 11. kvě 21.35 mesa-r22.05.1 
-rw-rw-r--.  1 jose jose 2098006607 27. srp 21.51 mesa-r22.05.1.zip 
[user@login1 mesaStar]$

cd into unpacked archive and get current directory with command pwd.

[user@login1 mesaStar]$ cd mesa-r22.05.1/ 
[user@login1 mesa-r22.05.1]$ pwd 
/home/user/projects/mesaStar/mesa-r22.05.1 
[user@login1 mesa-r22.05.1]$

export the path returned by command pwd as MESA_DIR:

export MESA_DIR=$HOME/projects/mesaStar/mesa-r22.05.1

Compile MESA star

cd to $MESA_DIR directory and build mesa STAR:

cd $MESA_DIR
./install

Installation script can take some time as it performs checks if code is working properly.

Once the installation is done, message MESA installation was successful will be shown.

Configure MESA SDK and MESA star permanently in ~/.bashrc

To avoid the need to export again environment variables as it was done above, one can modify own ~/.bashrc file .

Open own ~/.bashrc in nano (or in any editor of your choice)

nano ~/.bashrc

and append (do not forget to modify the MESA_DIR to reflect your mesa star installation directory! )

export MESASDK_ROOT=$HOME/mesasdk
source $MESASDK_ROOT/bin/mesasdk_init.sh 
export MESA_DIR=$HOME/projects/mesaStar/mesa-r22.05.1

in all new shells, since now, mesa and mesaSDK will be activated automatically.

Further reading