October 5, 2022

Install MESA and Gyre on Ubuntu 20.04.5 LTS

Define paths

Add these to your .zshrc

export MESASDK_ROOT=/home/pau/treball/MESA/mesasdk-x86_64-linux-22.6.1
export MESA_DIR=/home/pau/treball/MESA/mesa-r22.05.1
export GYRE_DIR=/home/pau/treball/MESA/mesa-r22.05.1/gyre/gyre
export OMP_NUM_THREADS=2

Create a directory where we’ll store everything

mkdir /home/pau/treball/MESA

Download MESASDK from here (last release, linux-22.6.1 in this example) to /tmp

http://www.astro.wisc.edu/~townsend/resource/download/mesasdk/

extract it to the directory we chose

tar xvfz /tmp/*.tar.gz -C "$MESASDK_ROOT"

Source it

source $MESASDK_ROOT/bin/mesasdk_init.sh

Download MESA from here (last release, mesa-r22.05.1 in this example) to /tmp

https://zenodo.org/record/6547951/files/

unzip /tmp/*.zip
mv /tmp/mesa-r22.05.1 /home/pau/treball/MESA

Export paths

export MESASDK_ROOT=/home/pau/treball/MESA/mesasdk-x86_64-linux-22.6.1
export MESA_DIR=/home/pau/treball/MESA/mesa-r22.05.1
export GYRE_DIR=/home/pau/treball/MESA/mesa-r22.05.1/gyre/gyre
export OMP_NUM_THREADS=2

Install MESA

cd $MESA_DIR
./install

Note: If your shell is terminating the installation, typically when running tests for the EOS, this is due to a lack of RAM. What I did to fix this problem was to kill the xserver and run install from a terminal without Xorg or anything else running.

Install GYRE

cd $GYRE_DIR
make

Install jupyter lab

If you want to understand how MESA and gyre work, the best you can do is to check out this tutorial by Earl Bellinger: https://github.com/earlbellinger/mesa-gyre-tutorial-2022

Unfortunately, jupyter notebook fails to load his notebook with the error you see in the image. Seemingly jupyter is known for this kind of problems. And seemingly jupyterlab will replace it soon.

pip3 install jupyterlab

If this fails, try to downgrade (I love linux and python regressions, it is so microsoft-ish, so vintage, so retro!)

pip3 install markupsafe==2.0.1

Using different MESA and GYRE releases

Sometimes you need to use an outdated version of MESA because this or the other extra-hook was written for a particular version of MESA. What I do is to add the paths to a different shell. For instance, my default shell is zsh but for an older version of MESA I am using, I am using bash and then define in .bashrc the following paths

export MESASDK_ROOT=/home/pau/treball/MESA/mesasdk
export MESA_DIR=/home/pau/treball/MESA/mesa-r10398
export GYRE_DIR=/home/pau/treball/MESA/mesa-r10398/gyre/gyre
export OMP_NUM_THREADS=2>/pre>

This way, in order to use the older version of MESA the only think I have to do is to switch to bash.

A silly script

Since I am doing tests again and again, I have defined this script to create a work directory every
time I need a new one:

iapetus% cat bin/CreateMESAwork.sh 
#!/bin/sh
cp -R $MESA_DIR/star/work .
cp -R $MESA_DIR/star/defaults/*.list work
cd work

Using sh to interface with the kernel avoids problems with bash and zsh.