{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# `GiRaFFE_NRPy`: Introduction\n", "\n", "## Authors: Patrick Nelson & Zach Etienne\n", "\n", "* ~~The force-free electrodynamics (FFE) system of equations describes highly magnetized, tenuous plasmas. As such, it provides an accurate description of the dynamics of most plasma in the Universe, including regions of strong, rapidly changing gravitational fields (described by the equations of general relativistic FFE, or GRFFE). Understanding the dynamics of black hole and neutron star magnetospheres for example could provide deeper insights into pulsars or possible electromagnetic precursors to detectable gravitational wave events. Thus the physical scenarios of interest for a simulation code capable of solving the GRFFE equations fall into two categories: binary compact objects and single, isolated compact objects.~~\n", "* ~~Next paragraph -- talk about importance of modeling magnetospheres of compact binaries~~\n", "* Next paragraph -- talk about importance of modeling single magnetospheres. First a paragraph on NS magnetospheres, then a paragraph on BH magnetospheres (drawing connection to analytical work, and emphasizing that much beyond the simplest cases is still not understood. For example, given a *spinning* black hole with some initial spin and exterior magnetic field, what does the equilbrium B field look like? How about for a spinning neutron star? Understanding these equilibria magnetospheres is not only important by itself, but could also provide reasonable default magnetosphere configurations for individual components of a compact binary system.)\n", "* ~~In a previous work, we introduced a tool, `GiRaFFE`, for studying systems in which the equations of GRFFE well describe the dynamics. [Extra couple sentences about \"Paper I\", being sure to mention it's an implementation of the Paschalidis et al approach and resulted in the first open-source GRFFE code for dynamical spacetimes, and it's in the ETK.] Here we introduce an improved version, `GiRaFFE_NRPy`, which has several advantages:~~\n", " 1. ~~Documentation is amazing. Written entirely within pedagogical Jupyter notebooks.~~\n", " 1. ~~Much of the code is automatically generated using the Python-based NRPy+, which converts tensorial expressions written by hand in Einstein-like notation, into highly optimized C code (supporting CSE and SIMD).~~\n", " 1. As such, GiRaFFE_NRPy is largely agnostic to the underlying infrastructure, and can be quickly modified to run in arbitrary parallel coding infrastructures like the Einstein Toolkit, or just be run as a standalone serial code.\n", " 1. A-field schemes are highly robust and work better with infrastructure-agnostic schemes than schemes that evolve the magnetic fields directly, as they do not require special treatment of magnetic fields at grid boundaries to ensure the divergence-free constraint remains satisfied. Further, GiRaFFE_NRPy contains both staggered and unstaggered A-field schemes, whereas the original GiRaFFE only supported the former. Granted, staggered is generally the more robust option (reference the Balsara test from Giacomazzo et al) in the context of complicated shock fronts, many infrastructures do not support staggered gridfunctions, and unstaggered A-field schemes have been shown to pass a large number of challenging code tests (e.g., the Mewes et al paper and Giacomazzo et al paper).\n", "* Precursor EM signals from GW sources due to e.g., dynamical, interacting magnetospheres.\n", "* Gravitational wave sources aren't the only ones that `GiRaFFE_NRPy` could model. For example it could provide deeper insights into isolated neutron star (e.g., pulsar) or black hole magnetospheres. <- part of intro paragraph.\n", "* Mention original GiRaFFE paper (~2-3 sentences) and how we improve upon it using NRPy+ (another ~2-3 sentences).\n", "* After adding the above, let's improve the flow of this introduction.\n", "\n", "The force-free electrodynamics (FFE) system of equations describes highly magnetized, tenuous plasmas. As such, it provides an accurate description of the dynamics of most plasma in the Universe, including regions of strong, rapidly changing gravitational fields (described by the equations of general relativistic FFE, or GRFFE). For example, understanding the dynamics of isolated and binary black hole and neutron star magnetospheres could provide deeper insights into pulsars or possible electromagnetic [precursors](https://arxiv.org/pdf/1304.1805.pdf) to detectable gravitational wave events. Thus, the physical scenarios of interest for a simulation code capable of solving the GRFFE equations fall into two categories: binary compact objects and single, isolated compact objects.\n", "\n", "One primary focus of modelling compact objects in the GRFFE regime is the case of compact binaries that emit both gravitational and electromagnetic radiation, making them the subjects of multimessenger astronomy. With the detection of simultaneous gravitational waves and electromagnetic radiation from the same source, [GW170917](https://journals.aps.org/prl/pdf/10.1103/PhysRevLett.119.161101), the era of multimessenger astronomy has begun. As such, it is more important than ever before to have accurate models of the systems we expect to be able to produce both such signals. It is also possible for colliding black holes with accretion disks and systems with one black hole and one neutron star to produce EM and GW signals simultaneously that could be modelled using GRFFE. There may even be some cases in which compact binaries may emit [precursor signals](https://arxiv.org/pdf/1304.1805.pdf) before the gravitational wave signals.\n", "\n", "Single compact objects, especially the magnetospheres of black holes and neutron stars, are also sources of interest. These systems are not yet well understood. By simulating such systems, we can find equilibrium solutions to their magnetospheres and generate predictions that can be compared to observation, yielding deeper insights into these systems. See [here](https://arxiv.org/abs/1112.2622) and [here](https://arxiv.org/pdf/1310.3274.pdf). Komissarov was the first to study black hole magnetospheres numerically (see [here](https://arxiv.org/abs/astro-ph/0402403) and [here](https://arxiv.org/pdf/astro-ph/0501599.pdf)), as well as the magnetospheres of [neutron stars](https://arxiv.org/abs/astro-ph/0510310). Reasonable magnetic field configurations for single compact objects can also be used as starting points to generate compact binary initial data.\n", "\n", "In [Paper I](https://arxiv.org/pdf/1704.00599.pdf), we introduced the first open-source GRFFE code for dynamical spacetimes, implementing the formalism of [Paschalidis 2013](https://arxiv.org/pdf/1310.3274.pdf) as an Einstein Toolkit (ETK) thorn. We expand on that work here using the NRPy+ infrastructure instead of the ETK. NRPy+ offers several advantages; perhaps foremost among these is the capability for open-source code generation. In many cases, we are able to write the equations of GRFFE in Einstein notation in Python notebooks, and from these, generate highly optimized C code. This code generation does not require expensive software licences and is well-documented in Jupyter notebooks, which enable the code to be seen right next to the equations typeset using $\\LaTeX$. Because much of the code is generated on the fly, NRPy+ is largely agnostic to the underlying infrastructure and much of what we do here could be ported to other infrastructures. However, for this paper, we write the code as a standalone C program. (There's also a secret advantage that will help us later!)\n", "\n", "We continue to use the A-field formulation that was used in [Paper I], which is also used in [IllinoisGRMHD](https://arxiv.org/pdf/1501.07276.pdf), and is laid out in detail [here](https://arxiv.org/pdf/1310.3274.pdf). This helps improve stability by guaranteeing the no magnetic monopoles appear without divergence cleaning or other such algorithms. \n", "\n", "We also provide options for both staggered and unstaggered formulations of the code. The staggered version is more robust for complicated shock fronts [see here](https://arxiv.org/pdf/1009.2468.pdf) **\"Balsara\" doesn't appear in this paper** **Zach says: look at the references: \"Most of the details on the mathematical and numerical\n", "setup... are discussed in depth in [6, 18–20].\"**, while the unstaggered version can still be implemented in an infrastructure that does not support staggered gridfunctions.\n", "\n", "**vv Old vv**\n", "\n", "General-Relativistic, Force-Free Electrodynamics (GRFFE) is a major part of this. These equations describe a very tenuous, magnetically-dominated plasma in strongly curved spacetimes. We expect to see such systems in the accretion disks of binary black holes (BBH) and in the magnetospheres of neutron stars. While the interiors of pulsars and neutron stars would require full ideal General-Relativistic Magnetohydrodynamics (GRMHD) simulations, codes exist that match the interiors to the exteriors [Paschalidis 2013](https://arxiv.org/pdf/1310.3274.pdf).\n", "\n", "`GiRaFFE_NRPy` rewrites the original `GiRaFFE` in a manner made to be more compatible with NRPy+, allowing us to generate large, complicated portions of the code quickly and easily. It solves the equations of General-Relativistic, Force-Free Electrodynamics (GRFFE), an special case of General-Relativistic Magnetohydrodynamics (GRMHD) in which pressures and densities are zero. \n", "\n", "**Numerical methods:**\n", "\n", "To do so, initial data must first be generated. Conventionally, this is given in the forms of equations describing the vector potential $A_i$ and electric field $E^i$. From these expressions, $A_i$ is set directly; the magnetic field $B^i$ is computed from $A_i$ analytically and, with $E^i$, used to calculate the initial Valencia three-velocity $\\bar{v}^i$. Then, the densitized Poynting flux $\\tilde{S}_i$ is calculated from $\\bar{v}^i$. \n", "\n", "At each timestep, the conservative variables $A_i$ and $\\tilde{S}_i$ are advanced through time using the method of lines (MoL). Reconstruction methods, solving the Riemann problem, and finite-differencing methods are used to calculate spatial derivatives, and an RK solver handles the time evolution. Then, we update the primitive variables. $B^i$ is numerically calculated from $A_i$ and fixes are applied to $\\tilde{S}_i$ before calculating $\\bar{v}^i$ at the new timestep. Another algorithm is applied to $\\bar{v}^i$ to preserve current sheets in the $x$-$y$ plane, and $\\tilde{S}_i$ is updated to be consistent with these changes. \n", "\n", "We must also consider whether we will employ a purely cell-centered approach or a staggered one. Both have their advantages, so ultimately, we will use a combination of them, using the staggered prescription throughout most of the grid for its stability and the unstaggered prescription near coordinate singularities to avoid them. This will require us to create two separate functions to calculate the right-hand sides of $A_k$ and $\\Phi$ as well as for calculating $B^i$ from $A_k$, as will be illustrated in the list below. We will also need separate main drivers because our choice of prescription affects what PPM reconstructions will be done and when they will be needed.\n", "\n", "**TODO: More background and citations.**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Adapted from the slides for my presentation, 2020-09-25:**\n", "\n", "GRFFE is a set of equations that govern the behavior of diffuse plasmas in strongly curved spacetimes in which the magnetic pressure dominates the gas pressure. It is a special case of ideal GRMHD, which allows for several simplifications. In particular, the conservative-to-primitive solver is greatly simplified, and the necessary equations can easily be analytically inverted.\n", "\n", "Some of the first work done with these equations was done by Wald in the 1970s, who found several analytic solutions for black hole magnetospheres. One particularly interesting solution is known as “Exact Wald”, which consists of a spinning black hole in a uniform magnetic field parallel to the black hole’s spin axis. This creates a system which is static in time. Another solution is the “Magnetospheric Wald”, which is similar to the first, but represents a plasma-filled system that results in a current sheet forming around the black hole, where there is a sharp change in the magnetic field. It has been called the “ultimate Rosetta stone” by Komisarrov for black hole electrodynamics. These systems have become important tests for GRFFE codes. The Exact Wald system is static, which allows us to use the initial data as an exact solution. While there is no static solution for the Magnetospheric Wald system, its current sheet is an important physical phenomenon we want to study, so we need to make sure our code doesn’t dissipate it too rapidly.\n", "[Wald, 1974](https://doi.org/10.1103/PhysRevD.10.1680)\n", "[Komisarrov, 2004](https://academic.oup.com/mnras/article/350/2/427/1113688)\n", "\n", "The Blandford and Znajek mechanism is an early analytic solution to the GRFFE equations. It was motivated by the study of active galactic nuclei when it became apparent that these objects could not be powered by a large pulsar or group of pulsars. This model consists of a Kerr black hole surrounded by an accretion disc through which an external current is flowing. This current creates a magnetic field which threads the black hole; the plasma is perfectly conducting, allowing E x B = 0 to hold. This causes some of the energy from the black hole to be emitted as light. This has been confirmed numerically by Spitkovsky for both the aligned and oblique cases, referring to the alignment of the black hole spin and magnetic field through the black hole.\n", "[Blandford & Znajek, 1977](https://academic.oup.com/mnras/article/179/3/433/962905)\n", "[Spitkovsky, 2006](https://iopscience.iop.org/article/10.1086/507518)\n", "\n", "Another important system governed by GRFFE is the magnetosphere of a neutron star. There are toy systems that represent this type of system such as the aligned rotator that are used for code tests; recently, analysis of more detailed and realistic systems has shown that after thousands of years, these systems can become unstable as the FFE conditions break down, releasing large bursts of energy that might be seen as transients.\n", "[Akgün, Cerdá-Durán, Miralles, Pons, 2018](https://arxiv.org/abs/1706.07990)\n", "\n", "As previously mentioned, Blandford and Znajek provided a simple tool for understanding black hole accretion disks by modeling a steady-state, axisymmetric magnetosphere and a method for extracting energy from the black hole spin. It is also the proposed mechanism for many high-energy transients over a wide range (i.e., a factor of twenty) of time scales. It is also useful for explaining relativistic jets that are observed coming from many galaxies, such as M87. This galaxy has been of particular image lately, since the supermassive black hole at the galaxy’s center was directly imaged recently.\n", "[Blandford & Znajek, 1977](https://academic.oup.com/mnras/article/179/3/433/962905)\n", "[Thoelecke, Tsuruta, Takahashi, 2017](https://arxiv.org/abs/1702.07322)\n", "[Nakamura et al., 2018](https://arxiv.org/abs/1810.09963)\n", "\n", "There have been even more recent developments in this field; in July, another group published a code that solves the GRFFE equations in spherical coordinates using the ETK. While there are, of course, many similarities between their project and ours, there are also several differences. Perhaps the biggest is the formalism used. I mentioned earlier that the equations we use are a special case of idead GRMHD; on the other hand, their formalism starts from Einstein field equations and adds Maxwell’s equations. This leads to them using different conserved variables: while we use the vector potential and Poynting flux, they use the electric and magnetic fields. This formalism was developed by by Komisarrov in 2004 and was partially motivated by the Blandford-Znajek mechanism.\n", "[Mahlmann, Aloy, Mewes, Cerdá-Durán, 2020](https://arxiv.org/abs/2007.06580)\n", "[Komisarrov, 2004](https://academic.oup.com/mnras/article/350/2/427/1113688)\n", "\n", "This paper naturally has several code tests in common with GiRaFFE; that is, they are the same between this paper, the original GiRaFFE paper, and what I’m working on now. For instance there are 1D tests of the characteristic waves of the equations and tests of static solutions, like the previously mentioned exact wald, and black hole magnetospheres such as the Magnetospheric Wald solution and the split-monopole. One particular thing I noticed is that they performed a dedicated test to study how their code handled current sheets; I also noticed that their paper doesn’t mention using a dedicated current sheet prescription. Their current sheet test instead analyzes the dissipation caused by different reconstruction methods.\n", "[Mahlmann, Aloy, Mewes, Cerdá-Durán, 2020](https://arxiv.org/abs/2007.06580)\n", "\n", "https://arxiv.org/pdf/astro-ph/0210618.pdf \n", "\n", "https://arxiv.org/pdf/astro-ph/0402403.pdf \n", "\n", "https://arxiv.org/pdf/astro-ph/0501599.pdf \n", "\n", "https://arxiv.org/pdf/astro-ph/0503420.pdf \n", "\n", "https://arxiv.org/pdf/astro-ph/0510310.pdf \n", "\n", "https://arxiv.org/pdf/astro-ph/0601410.pdf \n", "\n", "https://arxiv.org/pdf/1009.2468.pdf \n", "\n", "https://arxiv.org/pdf/1112.2622.pdf \n", "\n", "https://arxiv.org/pdf/1304.1805.pdf \n", "\n", "https://arxiv.org/pdf/1310.3274.pdf \n", "\n", "https://arxiv.org/pdf/1501.07276.pdf \n", "\n", "https://arxiv.org/pdf/1704.00599.pdf \n", "\n", "https://arxiv.org/abs/2002.06225 \n", "\n", "https://arxiv.org/pdf/2007.06580.pdf " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os,sys\n", "nrpy_dir_path = os.path.join(\"..\")\n", "if nrpy_dir_path not in sys.path:\n", " sys.path.append(nrpy_dir_path)\n", "\n", "import cmdline_helper as cmd # NRPy+: Multi-platform Python command-line interface\n", "cmd.output_Jupyter_notebook_to_LaTeXed_PDF(\"Tutorial-GiRaFFE_NRPy-Introduction\")" ] } ], "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.10.4" } }, "nbformat": 4, "nbformat_minor": 2 }