"Nerpy", the NRPy+ mascot. Photo CC2.0 Pacific Environment (modified).

Encoding partial differential equations (PDEs) into high-performance software by hand (usually in a low-level language like C or FORTRAN) can be a frustrating, error-prone process.

NRPy+ ("Python-based code generation for numerical relativity... and beyond!") is a Python package aimed at accelerating this process. Users may input complex expressions in clean tensorial form (Einstein notation), which acts to minimize human error. NRPy+ processes this input and outputs highly optimized C code with CSE and/or SIMD compiler intrinsics if desired.

Interactive NRPy+ Tutorial:
Be sure to check out the new Colliding Black Holes tutorial module!

Unlike other software packages with similar functionality, NRPy+ requires no expensive Mathematica or Maple license to function. Instead, it makes extensive use of the powerful, open-source SymPy as its computer algebra system back-end. In this way, NRPy+ is designed to lower the barrier to entry for new users. Though it was originally designed to greatly accelerate software development for numerical relativity (i.e., solving Einstein's equations of general relativity on the computer), NRPy+ can be used to rapidly develop software to solve much broader classes of hyperbolic and parabolic PDEs. By default it supports finite difference approaches, but can be extended to accommodate other numerical representations of derivatives as well.

SENR ("the Simple, Efficient Numerical Relativity code") is a fully-functional, OpenMP parallelized numerical relativity code in C that simply incorporates the C code generated by NRPy+ where needed. Its uncluttered appearance and small number of lines of code make the algorithmic underpinnings of a numerical relativity code completely transparent.

The NRPy+/SENR software packages have implemented a new generalized approach for solving Einstein's equations of general relativity in singular coordinate systems (built upon the pioneering work of our colleagues: [1], [2]), with a goal of modeling black hole and neutron star binaries at about 1/100 the cost in memory of more traditional, AMR-based numerical relativity software. We aim to leverage this cost savings, as described in this presentation, to unlock the desktop computer as a core tool for gravitational wave astrophysics.

New! (Nov. 2018)

Interactive NRPy+ Tutorial

Non-interactive, bare-bones version

2018 Lisbon ETK Workshop Presentation

(Interactive Jupyter notebooks generously hosted by mybinder).

(June 2018)

SENR can do black hole binary mergers in a co-rotating frame!

Introductory presentation on NRPy+/SENR.

Current Status

An at-a-glance summary of recent progress from ongoing projects.

Dec. 2018: Completed NRPy+ tutorial module enabling simulations of black hole collisions! (Brill-Lindquist initial data, evolved in pure axisymmetry using BSSN in curvilinear coordinates.)

Fall 2018: Completed NRPy+ tutorial modules on solving scalar wave equation, Maxwell's equations, constructing Psi_4, and Einstein's equations in curvilinear coordinates using NRPy+

Summer 2018: Basic NRPy+ tutorial

Spring 2018: Black hole binary mergers in corotating cylindrical coordinates, using NRPy+/SENR! (Click Intro Presentations button in Menu Bar)

Dec. 22, 2017: Released first paper on NRPy+/SENR

Recent results (prior to the black hole binary work) are summarized in our first paper.

Key Result from the First Paper: Black Hole Spectroscopy

We performed a black hole head-on collision with SENR in sinh-spherical coordinates, and compared the resulting waveform (as measured by the absolute value of the real part of the Weyl scalar \Psi_4; the vertical scale is arbitrary) from our calculation with the exponentially decaying waveform predicted by the black hole perturbation theory.

Notice that we find excellent phase and amplitude agreement to nearly 7 decades in amplitude. The same calculation performed on a Cartesian AMR grid at high resolution results in disagreement after only about 3 or 4 decades, indicating the importance of using spherical-like coordinates in the gravitational wavezone.

Click on the image to learn more about SENR!

Back to top


Zachariah B. Etienne is an assistant professor of Mathematics at West Virginia University.

Ian Ruchlin was a postdoctoral research associate in the Mathematics Department at West Virginia University.

Back to top