{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "\n", "# [Static Trumpet Black Hole](https://arxiv.org/abs/1403.5484) Initial data\n", "\n", "## Authors: Terrence Pierre Jacques, Zach Etienne & Ian Ruchlin\n", "### Formatting improvements courtesy Brandon Clark\n", "\n", "## This notebook introduces a module establishing Static Trumpet Black Hole initial data, based on research by [Dennison and Baumgarte, 2014 Class. Quantum Grav. 31 117001](https://arxiv.org/abs/1403.5484). It allows conversion from Schwarzschild spacetime to any coordinate system detailed in [reference_metric.py](../edit/reference_metric.py), using the [Exact ADM Spherical-or-Cartesian-to-BSSNCurvilinear converter module](Tutorial-ADM_Initial_Data-Converting_Exact_ADM_Spherical_or_Cartesian_to_BSSNCurvilinear.ipynb). Emphasizing isotropic coordinates, it validates against the original SENR code.\n", "\n", "**Notebook Status:** Validated \n", "\n", "**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](Tutorial-Start_to_Finish-BSSNCurvilinear-Exact_Initial_Data.ipynb); momentum constraint is zero), and all quantities have been validated against the [original SENR code](https://bitbucket.org/zach_etienne/nrpy).\n", "\n", "### NRPy+ Source Code for this module: [BSSN/StaticTrumpet.py](../edit/BSSN/StaticTrumpet.py)\n", "\n", "## Introduction:\n", "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 $\\textit{trumpet geometry}$. Moreover, all expressions are surprisingly simple. This module sets the static trumpet black hole at the origin." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Table of Contents: \n", "$$\\label{toc}$$\n", "\n", "1. [Step 1](#initialize_nrpy): Set up the needed NRPy+ infrastructure and declare core gridfunctions\n", "1. [Step 2](#conformal_factor_psi): The conformal factor $\\psi$\n", " 1. [Step 2.a](#define_psi): Define the conformal factor $\\psi$\n", " 1. [Step 2.b](#nonzero_gamma): Define and construct nonzero components of $\\gamma_{ij}$\n", "1. [Step 3](#extrinsic_curvature): Define and construct nonzero components of the extrinsic curvature $K_{ij}$, at the radius $R_0 = M$\n", "1. [Step 4](#lapse_shift): Construct Lapse function $\\alpha$ and components of shift vector $\\beta$\n", "1. [Step 5](#code_validation): Code Validation against `BSSN.StaticTrumpet` NRPy+ module\n", "1. [Step 6](#latex_pdf_output): Output this notebook to $\\LaTeX$-formatted PDF file" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Step 1: Set up the needed NRPy+ infrastructure and declare core gridfunctions \\[Back to [top](#toc)\\]\n", "$$\\label{initialize_nrpy}$$\n", "\n", "First, we will import the core modules of Python/NRPy+ and specify the main gridfunctions that we will need. \n", "\n", "**Input for initial data**:\n", "\n", "* The black hole mass $M$.\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:06:19.671131Z", "iopub.status.busy": "2021-03-07T17:06:19.670338Z", "iopub.status.idle": "2021-03-07T17:06:20.003014Z", "shell.execute_reply": "2021-03-07T17:06:20.002413Z" } }, "outputs": [], "source": [ "# Step P0: Load needed modules\n", "import sympy as sp # SymPy: The Python computer algebra package upon which NRPy+ depends\n", "import NRPy_param_funcs as par # NRPy+: Parameter interface\n", "import indexedexp as ixp # NRPy+: Symbolic indexed expression (e.g., tensors, vectors, etc.) support\n", "\n", "# All gridfunctions will be written in terms of spherical coordinates (r, th, ph):\n", "r,th,ph = sp.symbols('r th ph', real=True)\n", "\n", "thismodule = \"StaticTrumpet\"\n", "\n", "# Step 0: Set spatial dimension (must be 3 for BSSN)\n", "DIM = 3\n", "par.set_parval_from_str(\"grid::DIM\",DIM)\n", "\n", "# Step 1: Set psi, the conformal factor:\n", "# Input parameters:\n", "M = par.Cparameters(\"REAL\", thismodule, [\"M\"], 1.0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Step 2: The conformal factor $\\psi$ \\[Back to [top](#toc)\\]\n", "$$\\label{conformal_factor_psi}$$" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "## Step 2.a: Define the conformal factor $\\psi$ \\[Back to [top](#toc)\\]\n", "$$\\label{define_psi}$$\n", "\n", "\n", "The conformal factor, defined in equation 13 of [Dennison and Baumgarte (2014)](https://arxiv.org/abs/1403.5484), setting $R_0 = M$,\n", "$$ \\psi = \\sqrt{1 + \\frac{M}{r}}. $$" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:06:20.008204Z", "iopub.status.busy": "2021-03-07T17:06:20.007494Z", "iopub.status.idle": "2021-03-07T17:06:20.042219Z", "shell.execute_reply": "2021-03-07T17:06:20.042731Z" } }, "outputs": [], "source": [ "# Step 1: Set psi, the StaticTrumpet conformal factor\n", "# Dennison and Baumgarte (2014) Eq. 13\n", "# https://arxiv.org/pdf/1403.5484.pdf\n", "\n", "# psi = sqrt{1 + M/r }\n", "psi0 = sp.sqrt(1 + M/r)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "## Step 2.b: Define and construct nonzero components of $\\gamma_{ij}$ \\[Back to [top](#toc)\\]\n", "$$\\label{nonzero_gamma}$$\n", "\n", "The spatial metric, defined in equation 15 of [Dennison and Baumgarte (2014)](https://arxiv.org/abs/1403.5484),\n", "$$ \\gamma_{ij} = \\psi^4 \\eta_{ij}, $$\n", "\n", "where $\\eta_{ij}$ is the flat metric in spherical polar coordinates." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:06:20.052923Z", "iopub.status.busy": "2021-03-07T17:06:20.050955Z", "iopub.status.idle": "2021-03-07T17:06:20.058160Z", "shell.execute_reply": "2021-03-07T17:06:20.057609Z" } }, "outputs": [], "source": [ "# *** The physical spatial metric in spherical basis ***\n", "# Set the upper-triangle of the matrix...\n", "# Eq. 15\n", "# eta_00 = 1, eta_11 = r^2, eta_22 = r^2 * sin^2 (theta)\n", "gammaDD = ixp.zerorank2()\n", "gammaDD[0][0] = psi0**4\n", "gammaDD[1][1] = psi0**4 * r**2\n", "gammaDD[2][2] = psi0**4 * r**2*sp.sin(th)**2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Step 3: Define and construct nonzero components of the extrinsic curvature $K_{ij}$, at the radius $R_0 = M$ \\[Back to [top](#toc)\\]\n", "$$\\label{extrinsic_curvature}$$\n", "\n", "Components of the extrinsic curvature in spherical basis, defined in equations 19 and 20 of [Dennison and Baumgarte (2014)](https://arxiv.org/abs/1403.5484),\n", "\n", "$$ K_{rr} = - \\frac{r \\left( M-R_0 \\right) + MR_0}{r^2 f_1}, $$\n", "\n", "
\n", "\n", "$$ K_{\\theta\\theta} = \\frac{K_{\\phi\\phi}}{\\sin^2 \\theta} = f_1, $$\n", "\n", "
\n", "\n", "where $f_1 = \\sqrt{2r \\left( M-R_0 \\right) + R_0 \\left( 2M-R_0 \\right).}$ Setting $R_0 = M$, these equations reduce to\n", "\n", "
\n", "\n", "$$ K_{rr} = -\\frac{M}{r^2}, $$\n", "\n", "
\n", "\n", "$$ K_{\\theta\\theta} = \\frac{K_{\\phi\\phi}}{\\sin^2 \\theta} = M. $$\n" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:06:20.064855Z", "iopub.status.busy": "2021-03-07T17:06:20.063979Z", "iopub.status.idle": "2021-03-07T17:06:20.066649Z", "shell.execute_reply": "2021-03-07T17:06:20.066132Z" } }, "outputs": [], "source": [ "# *** The physical trace-free extrinsic curvature in spherical basis ***\n", "# Set the upper-triangle of the matrix...\n", "\n", "# Eq.19 and 20\n", "KDD = ixp.zerorank2()\n", "\n", "# K_{rr} = - M / r^2\n", "KDD[0][0] = -M / r**2\n", "\n", "# K_{theta theta} = K_{phi phi} / sin^2 theta = M\n", "KDD[1][1] = M\n", "\n", "KDD[2][2] = M * sp.sin(th)**2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Step 4: Construct Lapse function $\\alpha$ and components of shift vector $\\beta$\\[Back to [top](#toc)\\]\n", "$$\\label{lapse_shift}$$\n", "\n", "Laspe function and shift vector components, equation 15 of [Dennison and Baumgarte (2014)](https://arxiv.org/abs/1403.5484), setting $R_0 = M$,\n", "$$ \\alpha = \\frac{r}{r+M}, $$\n", "
\n", "$$ \\beta^r = \\frac{Mr}{\\left (r+M \\right)^2}, $$\n", "
\n", "$$\\beta^\\theta = \\beta^\\phi = 0. $$" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:06:20.073839Z", "iopub.status.busy": "2021-03-07T17:06:20.072806Z", "iopub.status.idle": "2021-03-07T17:06:20.076048Z", "shell.execute_reply": "2021-03-07T17:06:20.075307Z" } }, "outputs": [], "source": [ "# Eq. 15\n", "# alpha = r / (r+M)\n", "alpha = r / (r + M)\n", "\n", "betaU = ixp.zerorank1()\n", "# beta^r = Mr / (r + M)^2\n", "betaU[0] = M*r / (r + M)**2\n", "\n", "BU = ixp.zerorank1()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Step 5: Code Validation against `BSSN.StaticTrumpet` NRPy+ module \\[Back to [top](#toc)\\]\n", "$$\\label{code_validation}$$\n", "\n", "Here, as a code validation check, we verify agreement in the SymPy expressions for static trumpet black hole initial data between\n", "\n", "1. this tutorial and \n", "2. the NRPy+ [BSSN.StaticTrumpet](../edit/BSSN/StaticTrumpet.py) module." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:06:20.088128Z", "iopub.status.busy": "2021-03-07T17:06:20.087476Z", "iopub.status.idle": "2021-03-07T17:06:20.633629Z", "shell.execute_reply": "2021-03-07T17:06:20.634111Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Consistency check between StaticTrumpet tutorial and NRPy+ BSSN.StaticTrumpet module.\n", "ALL TESTS PASS\n" ] } ], "source": [ "# Step 3: Code Validation against BSSN.StaticTrumpet NRPy+ module\n", "\n", "import BSSN.StaticTrumpet as st\n", "st.StaticTrumpet()\n", "\n", "def compare(q1, q2, q1name, q2name):\n", " if sp.simplify(q1 - q2) != 0:\n", " print(\"Error: \"+q1name+\" - \"+q2name+\" = \"+str(sp.simplify(q1 - q2)))\n", " sys.exit(1) \n", "\n", "print(\"Consistency check between StaticTrumpet tutorial and NRPy+ BSSN.StaticTrumpet module.\")\n", "compare(alpha, st.alpha, \"alpha\", \"st.alpha\")\n", "for i in range(DIM):\n", " compare(betaU[i], st.betaU[i], \"betaU\"+str(i), \"st.betaU\"+str(i))\n", " compare(BU[i], st.BU[i], \"BU\"+str(i), \"st.BU\"+str(i))\n", " for j in range(DIM):\n", " compare(gammaDD[i][j], st.gammaDD[i][j], \"gammaDD\"+str(i)+str(j), \"st.gammaDD\"+str(i)+str(j))\n", " compare(KDD[i][j], st.KDD[i][j], \"KDD\"+str(i)+str(j), \"st.KDD\"+str(i)+str(j))\n", "print(\"ALL TESTS PASS\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# Step 6: Output this notebook to $\\LaTeX$-formatted PDF \\[Back to [top](#toc)\\]\n", "$$\\label{latex_pdf_output}$$\n", "\n", "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\n", "[Tutorial-ADM_Initial_Data-StaticTrumpet.pdf](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.)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2021-03-07T17:06:20.638462Z", "iopub.status.busy": "2021-03-07T17:06:20.637787Z", "iopub.status.idle": "2021-03-07T17:06:24.134361Z", "shell.execute_reply": "2021-03-07T17:06:24.133661Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Created Tutorial-ADM_Initial_Data-StaticTrumpet.tex, and compiled LaTeX\n", " file to PDF file Tutorial-ADM_Initial_Data-StaticTrumpet.pdf\n" ] } ], "source": [ "import cmdline_helper as cmd # NRPy+: Multi-platform Python command-line interface\n", "cmd.output_Jupyter_notebook_to_LaTeXed_PDF(\"Tutorial-ADM_Initial_Data-StaticTrumpet\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.1" } }, "nbformat": 4, "nbformat_minor": 4 }