Skip to content
FORTRAN code for the orbital dynamics of an extended spinning particle in curved spacetime
Fortran Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Spin Curvature Dynamics of a Pulsar in Kerr Spacetime

This code calculates the orbital motion of an astrophysical body, such as a pulsar, on a background Kerr spacetime. Going beyond the point particle approximation, we instead model an extended spinning body via the Mathisson-Papertrou-Dixon equations.

The code solves a set of ODEs numerically. These equations are based on the original works of Mathisson 1937, Papetrou 1951 and Dixon 1964. Consequently these equations are known as the MPD equations. More recent works can be found in Mashoon & Singh 2006, Singh 2005 and Singh, Wu & Sarty 2014.

Additional interesting discussion on the motion of extended bodies in GR can be found in Consta and Natatio, 2015

Getting Started

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

Starting steps

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 found in src/parameters.f

echo 'export SCDir="/Users/tomkimpson/Data/SpinCurv/"' >> ~/.bash_profile
source ~/.bash_profile

Just change the path to some appropriate local destination

You can check the environemnt variable has been added to bash_profile by either env or vim ~/.bashprofile

Set this to point to a local direcory.

The code should then run as is, out of the box. Try

to compile and run the code. Once you have checked that everything is running OK, you can then start playing. The code structure (mdoules, 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. eccentricity, orbital period, BH mass) 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 (rk.f).

In turn, rk.f calls derivatives.f and tensors.f to calculate e.g. the curvature tensors, ODEs and then integrates numerically.

tools/ As on the tin. Can switch between 3d and 2d plotting. Compares the spatial difference between the lamba=0 and lamba=1 cases. Useful for quickly eyeing Roemer delay. Requires interpolation.

A python wrapper has been provided to compile and run the code, We use a -O3 optimization. See the docs for discussion on the optimization flags

Numerical Method

We integrate the equations using a Runge-Kutta-Fehlberg algorithm with adaptive stepsize. See Press et al.


  • Tom Kimpson
You can’t perform that action at this time.