This module has been validated to exhibit convergence to zero of the Hamiltonian constraint violation at the expected order to the exact solution (see plot at bottom of the exact initial data validation start-to-finish tutorial notebook; momentum constraint is zero), and all quantities have been validated against the original SENR code.
This module sets up initial data for a merging black hole system in Cartesian coordinates.
# Step 1: Initialize core Python/NRPy+ modules
import sympy as sp # SymPy: The Python computer algebra package upon which NRPy+ depends
import NRPy_param_funcs as par # NRPy+: Parameter interface
import indexedexp as ixp # NRPy+: Symbolic indexed expression (e.g., tensors, vectors, etc.) support
Here we set up Brill-Lindquist initial data (Brill & Lindquist, Phys. Rev. 131, 471, 1963; see also Eq. 1 of Brandt & Brügmann, arXiv:gr-qc/9711015v1):
The conformal factor ψ for Brill-Lindquist initial data is given by ψ=eϕ=1+N∑i=1m(i)2|→r(i)−→r|;Kij=0,
where ψ is written in terms of the 3-metric γij as
γij=ψ4δij.The extrinsic curvature is zero: Kij=0
These data consist of N nonspinning black holes initially at rest. This module restricts to the case of two such black holes, positioned anywhere. Here, we implement N=2.
Inputs for ψ:
Additional variables needed for spacetime evolution:
# Step 2: Setting up Brill-Lindquist initial data
thismodule = "Brill-Lindquist"
BH1_posn_x,BH1_posn_y,BH1_posn_z = par.Cparameters("REAL", thismodule,
["BH1_posn_x","BH1_posn_y","BH1_posn_z"],
[ 0.0, 0.0, +0.5])
BH1_mass = par.Cparameters("REAL", thismodule, ["BH1_mass"],1.0)
BH2_posn_x,BH2_posn_y,BH2_posn_z = par.Cparameters("REAL", thismodule,
["BH2_posn_x","BH2_posn_y","BH2_posn_z"],
[ 0.0, 0.0, -0.5])
BH2_mass = par.Cparameters("REAL", thismodule, ["BH2_mass"],1.0)
# Step 2.a: Set spatial dimension (must be 3 for BSSN)
DIM = 3
par.set_parval_from_str("grid::DIM",DIM)
Cartxyz = ixp.declarerank1("Cartxyz")
# Step 2.b: Set psi, the conformal factor:
psi = sp.sympify(1)
psi += BH1_mass / ( 2 * sp.sqrt((Cartxyz[0]-BH1_posn_x)**2 + (Cartxyz[1]-BH1_posn_y)**2 + (Cartxyz[2]-BH1_posn_z)**2) )
psi += BH2_mass / ( 2 * sp.sqrt((Cartxyz[0]-BH2_posn_x)**2 + (Cartxyz[1]-BH2_posn_y)**2 + (Cartxyz[2]-BH2_posn_z)**2) )
# Step 2.c: Set all needed ADM variables in Cartesian coordinates
gammaDD = ixp.zerorank2()
KDD = ixp.zerorank2() # K_{ij} = 0 for these initial data
for i in range(DIM):
gammaDD[i][i] = psi**4
alpha = 1/psi**2
betaU = ixp.zerorank1() # We generally choose \beta^i = 0 for these initial data
BU = ixp.zerorank1() # We generally choose B^i = 0 for these initial data
Here, as a code validation check, we verify agreement in the SymPy expressions for Brill-Lindquist initial data between
# Step 3: Code Validation against BSSN.BrillLindquist NRPy+ module
import BSSN.BrillLindquist as bl
bl.BrillLindquist()
def compare(q1, q2, q1name, q2name):
if sp.simplify(q1 - q2) != 0:
print("Error: "+q1name+" - "+q2name+" = "+str(sp.simplify(q1 - q2)))
sys.exit(1)
print("Consistency check between Brill-Lindquist tutorial and NRPy+ BSSN.BrillLindquist module.")
compare(alpha, bl.alpha, "alpha", "bl.alpha")
for i in range(DIM):
compare(betaU[i], bl.betaU[i], "betaU"+str(i), "bl.betaU"+str(i))
compare(BU[i], bl.BU[i], "BU"+str(i), "bl.BU"+str(i))
for j in range(DIM):
compare(gammaDD[i][j], bl.gammaDD[i][j], "gammaDD"+str(i)+str(j), "bl.gammaDD"+str(i)+str(j))
compare(KDD[i][j], bl.KDD[i][j], "KDD"+str(i)+str(j), "bl.KDD"+str(i)+str(j))
print("ALL TESTS PASS")
Consistency check between Brill-Lindquist tutorial and NRPy+ BSSN.BrillLindquist module. ALL TESTS PASS
The following code cell converts this Jupyter notebook into a proper, clickable LATEX-formatted PDF file. After the cell is successfully run, the generated PDF may be found in the root NRPy+ tutorial directory, with filename Tutorial-ADM_Initial_Data-Brill-Lindquist (Note that clicking on this link may not work; you may need to open the PDF file through another means.)
import cmdline_helper as cmd # NRPy+: Multi-platform Python command-line interface
cmd.output_Jupyter_notebook_to_LaTeXed_PDF("Tutorial-ADM_Initial_Data-Brill-Lindquist")
Created Tutorial-ADM_Initial_Data-Brill-Lindquist.tex, and compiled LaTeX file to PDF file Tutorial-ADM_Initial_Data-Brill-Lindquist.pdf