This tutorial is a smaller version of the Einstein Toolkit tutorial. The tutorial in this page let's you download and install only the Einstein Toolkit modules ("thorns") that are needed in order to run a simple simulation. This tutorial can run on a laptop and should require less than one hour in total.
First we need to download some packages needed to compile the Einstein Toolkit.
If you use a Mac, you should first install MacPorts https://www.macports.org/install.php.
And then you can install the packages you need by executing these commands in a terminal:
sudo port install subversion mercurial wget git
sudo port install pkgconfig gcc7 openmpi fftw-3 gsl jpeg zlib hdf5 +fortran +gfortran openssl py-matplotlib
If you use Ubuntu, you should install the packages you need using these commands in a terminal:
sudo apt-get install subversion git mercurial wget python python-matplotlib curl
sudo apt-get install build-essential perl gfortran g++ libmpich-dev
sudo apt-get install libfftw3-dev libgsl-dev libatlas-base-dev libjpeg-dev libssl-dev
sudo apt-get install libhdf5-dev hdf5-tools libnuma-dev libltdl-dev libhwloc-dev zlib1g-dev
Now we create the directory where the tutorial material will be located
!mkdir Einstein_Toolkit_London
%cd Einstein_Toolkit_London
In this directory we now download the files used for this tutorial
!wget http://brunogiacomazzo.org/ETK_London_2019/einsteintoolkit_2019.th
!wget http://brunogiacomazzo.org/ETK_London_2019/tov_ETK_2019.par
We now create the directory where the simulation data will be stored
!mkdir simulations
Now we download the components of the Einstein Toolkit needed to run this tutorial
!curl -kLO https://raw.githubusercontent.com/gridaphobe/CRL/ET_2019_03/GetComponents
!chmod a+x GetComponents
Note: the following command sometimes may fail with an error similar to this:
"Server SSL certificate verification failed: issuer is not trusted".
In this case, open a terminal and type:
svn co <link_to_the_failed_repository>
where <link_to_the_failed_repository> should be replaced with the address that is printed by the SSL certificate error.
At this point svn will ask if you want to accept the certificate. Type p
to accept the certificate permanently and then rerun the GetComponents command below.
!./GetComponents einsteintoolkit_2019.th
%cd Cactus
!cp ../tov_ETK_2019.par ./par
Now we set up simfactory
!./simfactory/bin/sim setup-silent
Now we compile the Einstein Toolkit (this may take ~30 minutes or more)
#uncomment the line that refers to your operating system
!./simfactory/bin/sim build --machine=osx-macports --thornlist=thornlists/einsteintoolkit_2019.th
#!./simfactory/bin/sim build --machine=ubuntu --thornlist=thornlists/einsteintoolkit_2019.th
And now we are ready to run a simple simulation. In the example we use 2 MPI processes.
!./simfactory/bin/sim create-run tov_test --procs 2 --num-threads 1 --parfile=./par/tov_ETK_2019.par --basedir=../simulations/
Once the simulation has finished we can go in the output directory and have a look at the results.
%cd ../simulations/tov_test/
%cd output-0000/tov_ETK_2019/
!ls
# This cell enables inline plotting in the notebook
%matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
Let's have a look at the maximum of the rest-mass density
lin_data = np.genfromtxt("hydrobase-rho.maximum.asc")
lin_data
plt.plot(lin_data[:,1],lin_data[:,2])