This code calculates the trajectory of light (ray - geometrical optics) on a background Kerr spacetime surrounded by a dark matter halo.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
This code is written in FORTRAN with a gfortran compiler. Other compilers have not been tested. The gfortran installation binaries can be found here, although typically gfortran comes pre-installed on most Linux/Unix systems. If you have Homebew installed on OSX, you can simply run
brew install gcc
After cloning the repo, the first thing to do is to set the path to the output files that the code will produce. This can be done by setting the environment variable as
echo 'export DarkMatterDir="/Users/tomkimpson/Data/DM/"' >> ~/.bash_profile
source ~/.bash_profile
Just change the path Users/tomkimpson/Data/DM/
to some appropriate local path.
You can check the environemnt variable has been added to bash_profile
by either env
or vim ~/.bashprofile
The code should then run as is, out of the box. Try
run.py
to compile and run the code. Once you have checked that everything is running OK, you can then start playing. The code structure (modukes, subroutines etc.) is outlined below.
If making edits to the code, try to keep to the FORTRAN Style Guide
parameters.f
defines all the system parameters. That is, anything that needs changing (e.g. BH mass, BH spin) can be modified in this module
constants.f
is for calculations with those parameters for use later in the code. It can effectively be ignored - no changes should be necessary to this file
main.f
is where the code program is run from. After setting up the initial conditions (initial_conditions.f
) it then goes on to integrate the equations and save the output (`integration.f')
tensors.f
contains some useful subroutines for calculating e.g. metric, vector magnitudes etc.
A python wrapper has been provided to compile and run the code, run.py
. We use a -O3
optimization. See the docs for discussion on the optimization flags
PlotRays.py
does what is says on the tin. Can be switched between 3d and 2d by changing the opening `d' parameter
We integrate the equations using a Runge-Kutta-Fehlberg algorithm with adaptive stepsize. See Press et al.
The code is compiled using -fopenmp
to allow for parallel processing. Geodesic ray tracing naturally lends itself very well to parallel computation. See the OpenMP docs. To set the number of threads, use
export OMP_NUM_THREADS=1
When integrating numerically, an important consideration is the accuracy of the method. We can assess this by independently evaluating the Carter Constant, Q
This project is licensed under the MIT License - see the LICENSE.md file for details