Notebook Status: Validated
Validation Notes: 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.
These initial data are derived from a family of analytical coordinate systems representing the Schwarzschild spacetime. The coordinates extend smoothly through the black hole event horizon, the spatial coordinates are isotropic (so that the spatial metric can be written as a conformal factor to some power times a flat spatial metric), and, for almost all members of the family, the spatial slices take a so-called trumpet geometry. Moreover, all expressions are surprisingly simple. This module sets the static trumpet black hole at the origin.
BSSN.StaticTrumpet
NRPy+ module# Step P0: Load needed 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
# All gridfunctions will be written in terms of spherical coordinates (r, th, ph):
r,th,ph = sp.symbols('r th ph', real=True)
thismodule = "StaticTrumpet"
# Step 0: Set spatial dimension (must be 3 for BSSN)
DIM = 3
par.set_parval_from_str("grid::DIM",DIM)
# Step 1: Set psi, the conformal factor:
# Input parameters:
M = par.Cparameters("REAL", thismodule, ["M"], 1.0)
The conformal factor, defined in equation 13 of Dennison and Baumgarte (2014), setting R0=M, ψ=√1+Mr.
# Step 1: Set psi, the StaticTrumpet conformal factor
# Dennison and Baumgarte (2014) Eq. 13
# https://arxiv.org/pdf/1403.5484.pdf
# psi = sqrt{1 + M/r }
psi0 = sp.sqrt(1 + M/r)
The spatial metric, defined in equation 15 of Dennison and Baumgarte (2014), γij=ψ4ηij,
where ηij is the flat metric in spherical polar coordinates.
# *** The physical spatial metric in spherical basis ***
# Set the upper-triangle of the matrix...
# Eq. 15
# eta_00 = 1, eta_11 = r^2, eta_22 = r^2 * sin^2 (theta)
gammaDD = ixp.zerorank2()
gammaDD[0][0] = psi0**4
gammaDD[1][1] = psi0**4 * r**2
gammaDD[2][2] = psi0**4 * r**2*sp.sin(th)**2
Components of the extrinsic curvature in spherical basis, defined in equations 19 and 20 of Dennison and Baumgarte (2014),
Krr=−r(M−R0)+MR0r2f1,where f1=√2r(M−R0)+R0(2M−R0). Setting R0=M, these equations reduce to
# *** The physical trace-free extrinsic curvature in spherical basis ***
# Set the upper-triangle of the matrix...
# Eq.19 and 20
KDD = ixp.zerorank2()
# K_{rr} = - M / r^2
KDD[0][0] = -M / r**2
# K_{theta theta} = K_{phi phi} / sin^2 theta = M
KDD[1][1] = M
KDD[2][2] = M * sp.sin(th)**2
Laspe function and shift vector components, equation 15 of Dennison and Baumgarte (2014), setting R0=M, α=rr+M,
# Eq. 15
# alpha = r / (r+M)
alpha = r / (r + M)
betaU = ixp.zerorank1()
# beta^r = Mr / (r + M)^2
betaU[0] = M*r / (r + M)**2
BU = ixp.zerorank1()
BSSN.StaticTrumpet
NRPy+ module [Back to top]¶Here, as a code validation check, we verify agreement in the SymPy expressions for static trumpet black hole initial data between
# Step 3: Code Validation against BSSN.StaticTrumpet NRPy+ module
import BSSN.StaticTrumpet as st
st.StaticTrumpet()
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 StaticTrumpet tutorial and NRPy+ BSSN.StaticTrumpet module.")
compare(alpha, st.alpha, "alpha", "st.alpha")
for i in range(DIM):
compare(betaU[i], st.betaU[i], "betaU"+str(i), "st.betaU"+str(i))
compare(BU[i], st.BU[i], "BU"+str(i), "st.BU"+str(i))
for j in range(DIM):
compare(gammaDD[i][j], st.gammaDD[i][j], "gammaDD"+str(i)+str(j), "st.gammaDD"+str(i)+str(j))
compare(KDD[i][j], st.KDD[i][j], "KDD"+str(i)+str(j), "st.KDD"+str(i)+str(j))
print("ALL TESTS PASS")
Consistency check between StaticTrumpet tutorial and NRPy+ BSSN.StaticTrumpet 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-StaticTrumpet.pdf (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-StaticTrumpet")
Created Tutorial-ADM_Initial_Data-StaticTrumpet.tex, and compiled LaTeX file to PDF file Tutorial-ADM_Initial_Data-StaticTrumpet.pdf