IMPROVED METHODS FOR GENERAL RELATIVISTIC RADIATION HYDRODYNAMICS AND THEIR IMPACT ON SIMULATIONS OF NEUTRON STAR MERGERS AND CORE-COLLAPSE SUPERNOVAE By Steven Anthony Fromm A DISSERTATION Submitted to Michigan State University in partial fulfillment of the requirements for the degree of Physics — Doctor of Philosophy Computational Mathematics, Science and Engineering — Dual Major 2024 ABSTRACT Neutron star mergers and core-collapse supernovae are some of the most energetic events in the universe, reaching conditions not attainable in terrestrial laboratories. The study of these high energy-density astrophysical events relies on detailed multi-physics multi-scale modeling, ranging from nuclear and neutrino interactions to the large-scale dynamics gov- erned by general relativity. Simulations prove useful in exploring these models, but they are sensitive to the physical approximations and numerical methods used to build them, re- quiring a balance to be struck between higher computational cost and increasingly detailed physical models. Choices made for the treatment of the neutrinos and the inclusion of general relativistic effects greatly impact the dynamics of how these systems evolve, and impact the nucleosynthesis that occurs during these events. The Flash-X multi-physics code provides an ideal framework for creating the large-scale simulations necessary for studying both core- collapse supernovae and neutron star mergers. This dissertation will detail extending the capabilities in Flash-X with the addition of fully general relativistic solvers for neutrino radi- ation transport, hydrodynamics, a dynamic spacetime, the supporting infrastructure neces- sary for coupling them all together, and utilities to facilitate development of these solvers. A multi-group two-moment neutrino radiation transport solver makes use of a novel frequency discretization to improve computational efficiency. A high-order finite-difference scheme is applied to the hydrodynamics. A custom-built code-generator aids in the development of the dynamic spacetime solvers. A new method-of-lines time-discretization in Flash-X provides increased numerical stability and flexibility in choosing time-integration schemes appropriate for both the new and existing solvers. A full suite of rigorous tests validate these capabil- ities. Continuing work towards the coupled multi-physics multi-scale simulations necessary for neutron star mergers and core-collapse supernovae will be presented. ACKNOWLEDGMENTS Through this long and winding journey, from my time serving in the United States Army through a decade of undergraduate and graduate studies at Michigan State University (MSU), I have been fortunate to have had the unwavering support of my family, friends, and colleagues. Without being overly verbose, which many of you know I excel at, and dou- bling the length of this dissertation, it will be impossible to recognize everyone, so I would like to begin by expressing my deepest gratitude towards everyone I have met along the way. First and foremost, I would like to thank my family for their support and encouragement over the past many years. Without all of you, I would never have been able to focus so intently on my studies and research. I could never have accomplished this work without my past-and-present research advisors here at MSU. To Sean Couch, I am deeply grateful for all of your support, encouragement, and patience over the last few years while seeing me through to the finish line. To Luke Roberts, thank you for helping me get started on this work and continuing my studies at MSU. To Jaideep Singh, thank you for giving me the opportunity to start down this path after I had just started my undergraduate studies at MSU. To my guidance committee members Brian O’Shea, Heiko Hergert, and Wolfgang Kerzendorf, thank you for all of your advice you have offered and assistance you have provided during my graduate studies. To everyone at MSU in the Physics & Astronomy (PA) department and Facility for Rare Isotope Beams (FRIB), it would have been impossible to complete my work without all of you. To Mike Pajkos, Brandon Barker, and Zac Johnston, it has been an honor and privilege to work alongside you the past few years. To Kim Crosslan in the PA office and Elizabeth Deliyski in the Nuclear Theory group at FRIB, thank you for all of your support and patience during my time at MSU. iii I would also like to thank all of the members of the Flash-X team that I have worked with extensively over the past few years, in particular Klaus Weide, Anshu Dubey, Jared O’Neal, Austin Harris, Vassili Mewes, Sherwood Richers, and Stephen Fickas, for all of the guidance and assistance provided while working with Flash-X during my research. My graduate studies would have not been possible without the generous support I received from the United States Department of Energy Computational Science Graduate Fellowship (CSGF). Being awarded the CSGF at the beginning of my graduate studies allowed me to focus on my research from the start, and provided the opportunity to meet, work with, and learn from many researchers outside of my work in nuclear astrophysics. To everyone at the Krell Institute, especially the CSGF program manager Lindsey Eilts, thank you for all of your support during my time as a CSGF fellow. I am forever grateful for the opportunity to work on my CSGF practicum at Los Alamos National Laboratory, and I especially want to thank Oleg Korobkin, my research mentor for the project, for the opportunity to experience and learn about working in the national laboratories. Portions of this work were supported by the U.S. Department of Energy, Office of Science, Office of Advanced Scientific Computing Research, Department of Energy Computational Science Graduate Fellowship under Award Number DE-SC0019323. I would also like to acknowledge support from Michigan State University, the Facility for Rare Isotope Beams, and ExaStar project, part of the Exascale Computing project, throughout my time as a graduate student at MSU. Parts of this work were further supported by the computational resources provided by the Institute for Cyber-Enabled Research at Michigan State University. iv TABLE OF CONTENTS Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Chapter 2. Sensitivity to Neutrino Treatment . . . . . . . . . . . . . . . . . . 16 Chapter 3. General Relativistic Radiation Transport . . . . . . . . . . . . . . 24 Chapter 4. General Relativistic Hydrodynamics . . . . . . . . . . . . . . . . . 72 Chapter 5. Dynamic Spacetime Evolution . . . . . . . . . . . . . . . . . . . . . 91 Chapter 6. General Relativistic Solvers in Flash-X . . . . . . . . . . . . . . . . 117 Chapter 7. Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 BIBLIOGRAPHY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 APPENDIX A. Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 APPENDIX B. Tolman-Oppenheimer-Volkoff Equations . . . . . . . . . . . . 192 APPENDIX C. Eulerian 3+1 Decomposition of the Spacetime . . . . . . . . 195 APPENDIX D. Deriving the Moment Evolution Equations . . . . . . . . . . 198 APPENDIX E. Practical Expressions for the Fluid Frame Projections . . . 207 APPENDIX F. Neutrino-Matter Interation Source Term Jacobian . . . . . 210 APPENDIX G. Time-Integration Tableau . . . . . . . . . . . . . . . . . . . . . 213 v Chapter 1 Introduction Neutron star mergers (NSMs) are some of the most cataclysmic and energetic events in the universe. Neutron stars are highly-compact objects supported by degenerate neutron pressure, with masses M ⊙ ∼ (the mass of the sun) and radii 106 cm (Misner et al., 2017). ∼ Neutron stars are one possible remnant formed by the collapse of massive stars resulting in supernovae, as first proposed in Baade & Zwicky (1934) and later confirmed in Hewish et al. (1968) by the discovery of the pulsar, or magnetized rapidly spinning neutron star, at the center of the Crab Nebula, the remnant of a supernova observed in 1054 A.D. (Duyvendak, 1942; Mayall & Oort, 1942). Binary systems of neutron stars will radiate gravitational energy, leading to decaying orbits as first observed in Taylor et al. (1979). The inspiral and eventual merger of a binary neutron star system produces a violent collision that forms a remnant compact object; these type of mergers were first confirmed by the gravitational wave event GW170817 observed by the Advanced LIGO and Virgo observatories (Abbott et al., 2017). Neutron stars, their mergers, and the core-collapse supernovae (CCSNe) that form them reach conditions not attainable in terrestrial laboratories, capable of reaching densities of 1014 g cm− 3 and temperatures of ∼ 100 MeV (Perego et al., 2019). These extreme con- ∼ ditions provide ideal sites to study nuclear structure and reactions, such as constraining nuclear equations of state, and determining how and where heavier elements are formed through r-process nucleosynthesis. While information can be gleaned from observational evidence, numerical simulations based on detailed theoretical models are aptly suited for these studies and interpreting observations. The requisite physical details in these mod- els span disparate physical processes and time- and length-scales, encompassing everything 1 from nuclear reactions to the large-scale dynamics governed by Einstein’s theory of general relativity. Simulations of astrophysical events involving compact objects become increasingly com- putationally expensive with an increasing level of physical detail and the use of more sophis- ticated numerical methods. Limited by available computational resources, approximations must be made in order to make the necessary calculations in these simulations practical to perform. Achieving high-fidelity in these simulations requires balancing these concerns, often requiring the development or application of new methods to more efficiently include higher levels of detail. This can be incredibly challenging for large multi-physics, multi-scale simulations of events like neutron star mergers; every effort must be made to apply, improve, and create the tools necessary to accurately study these events. 1.1 Neutron Stars, Mergers, and Nucleosynthesis Neutron stars and their mergers serve as astrophysical laboratories for nuclear physics. As neutron stars have densities similar to those of nuclei, their structures can be used to con- strain nuclear equations of state for dense matter (Greif et al., 2020). The hot, dense matter ejected during neutron star mergers has been shown to produce r-process elements (Kasen et al., 2017; Hotokezaka et al., 2018; Rosswog et al., 2018). It is absolutely crucial to ensure models of neutron stars and their mergers include sufficient detail to be able to study their nuclear structure and interactions to relate back to the observational data. Relativistic stars in static equilibrium can be described by the Tolman-Oppenheimer- Volkoff (TOV) equations derived from Einstein’s equations of general relativity and the assumption of a perfect fluid (Misner et al., 2017). These equations describe the structure 2 Figure 1.1: Mass-radius relations for non-rotating neutron stars using various nuclear equa- tions of state. Maximum non-rotating neutron star mass 2.25+0.08 from Fan et al. (2024) (green dashed line) and the allowed radius of a 1.4M neutron star 10.2 km < R < 13.6 km from Greif et al. (2020) (blue shaded region) are shown for comparison. 0.07M ⊙ ⊙ − of the star through its enclosed mass, metric potential, and pressure; an equation of state relates the pressure and the fluid state (see appendix B for more on the TOV equations). Generating a series of equilibrium TOV solutions using a specific equation of state produces a range of mass-radius relations for neutron stars. Comparison of these mass-radius relations to observed and theoretical constraints can provide a measure of whether the chosen equation of state is capable of reproducing the expected mass and radius values. An example calculation of the mass-radius curves for different nuclear equations of state is shown in fig. 1.1. Five tabular nuclear equations of state1 are compared: LS220 (Lattimer 1These tables are available for download from stellarcollapse.org and were originally produced for use in O’Connor & Ott (2010). This collection has been updated and added to since the original publication. 3 1011121314R[km]1.01.21.41.61.82.02.22.4M/M(cid:12)BHBΛφDD2LS220SFHoSFHx & Swesty, 1991), DD2 (Hempel et al., 2012), BHBΛϕ (Banik et al., 2014), and SHFo/SFHx (Steiner et al., 2013a). The most recent constraint on the maximum mass for a non-rotating neutron star of 2.25+0.08 0.07 M ⊙ − found by Fan et al. (2024) is shown for comparison. Only one equation of state, DD2, reaches the maximum mass constraint, but all equations of state used in this analysis are capable of producing the typically-assumed neutron star mass of 1.4M ⊙ (Steiner et al., 2013b; Greif et al., 2020; Sotani et al., 2022). A further example of the importance of neutron stars in nuclear physics is the r-process nucleosynthesis that occurs in the material ejected during a neutron star merger. The neutron-rich outflow provides ideal conditions that allow for rapid neutron-capture rates that exceed β-decay rates to quickly build up heavy nuclei (Lattimer & Schramm, 1974; Figure 1.2: Volume rendering from a simulation of an equal-mass (1.35M ) binary neutron star merger using the SFHo equation of state. Results display the electron fraction from just before the merger and until 2.5 ms after. Figure from Radice et al. (2018). ⊙ 4 t−tmrg=−0.3msYet−tmrg=1.2mst−tmrg=0.6mst−tmrg=2.5ms Figure 1.3: Predicted nucleosynthesis equal-mass (1.35M ) binary neutron star merger using the SFHo equation of state. Solar abundances are included for reference. Based on data from Radice et al. (2018). ⊙ Symbalisty & Schramm, 1982; Eichler et al., 1989; Freiburghaus et al., 1999; Goriely et al., 2005). These predictions were confirmed in the observed kilonova afterglow of the GW170817 neutron star merger (Kasen et al., 2017; Hotokezaka et al., 2018; Rosswog et al., 2018). Detailed numerical simulations of neutron star mergers over a range of initial conditions and input physics are necessary for characterizing the ejected material and predicting the nu- cleosynthesis yields. Incredibly neutron-rich material is ejected during mergers on dynamical timescales of a few milliseconds due to tidal effects and shock heating of the collision, and on longer secular timescales via mechanisms such as neutrino-driven winds (Radice et al., 2018). Figure 1.2 shows an example of the earlier so-called dynamical ejecta in the first few milliseconds after the merger of an equal-mass (1.35M ⊙ ) binary system from one of our 5 6080100120140160180200A10−410−310−210−1100RelativeAbundancesSolar simulations in Radice et al. (2018). Initially, very neutron-rich material, characterized by low values of the electron fraction Ye, is ejected in the tidal plane, followed by the more isotropic shock-heated material. For this particular simulation, the ejected material remained fairly neutron rich with an average value of Ye ⟨ ⟩ = 0.22. The resulting predictions for the yields of r-process nucleosynthesis are shown in fig. 1.3; these results show the production of the ex- pected peaks near A 130 and A ∼ ∼ 195 when compared to the measured solar abundances given in Anders & Grevesse (1989); Arlandini et al. (1999). 1.2 Methods for Simulating NSMs and CCSNe Simulations of neutron star mergers and core-collapse supernovae pose significant computa- tional challenges. Accurately modeling the radiative transport of neutrinos, the hydrody- namics of the fluid, and the evolution of a dynamic spacetime rely on detailed numerical calculations over many degrees of freedom. Sufficient resolution for these degrees of freedom, such as time, space, and momentum, often requires a large number of computing resources and lengthy periods of time spent to run these simulations. Large-scale simulations typically employ a broad array of approximations and numerical methods to reduce the degrees of freedom and make a more practical use of the available resources and time. This section will survey some of the commonly used numerical methods for general relativistic radiation transport, hydrodynamics, and spacetime evolution that are applied in these simulations. 1.2.1 Neutrino Radiation Transport Neutrinos are effectively massless particles, and typically treated as radiation in a similar manner as photons. Neutrino radiation interacting with matter significantly impacts energy 6 transport (Burrows et al., 2006) and the composition of the material (Foucart, 2023) at the density and temperature scales present in core-collapse supernovae and neutron star mergers. Each species of neutrino, i.e., νe, ¯νe, νµ, ¯νµ, ντ , ¯ντ , can be characterized by a distribution function f (t, ⃗x, ⃗p) at a time t for a location ⃗x with momentum ⃗p. These seven degrees of freedom per neutrino species can be computationally challenging and expensive to resolve, leading to varying levels of approximation for including neutrinos and their interactions with matter in numerical simulations. 1.2.1.1 Neutrino Leakage One of the simplest approaches to including neutrinos in these simulations is by a method referred to as neutrino leakage. In this method, neutrinos are not directly evolved, but rather their interactions with the fluid are treated parametrically and used to directly alter the energy and composition of the fluid. These type of methods were originally applied to simulations of CCSNe in van Riper & Lattimer (1981) and have seen widespread use over the years, such as the simulations performed in O’Connor & Ott (2010); Perego et al. (2016). Ruffert et al. (1996) presented one of the first applications of a neutrino leakage scheme to neutron star merger simulations, and this method has seen continued use in works such as Rosswog & Liebend¨orfer (2003); Galeazzi et al. (2013); Radice et al. (2016, 2018). In a neutrino leakage scheme, the mean free paths for neutrinos are calculated based on the thermodynamic state of the fluid, and are used to determine the emission rates from regions of dense matter. Typical interactions for these calculations include charged-current β-processes, e.g., electron (e−) and positron (e+) capture on neutrons (n) and protons (p), scattering processes, e.g., an arbitrary neutrino species νi scattering off of nucleons, and pair production of neutrinos, e.g., by electron-positron annihilation and plasmon (γ) 7 decay (Ruffert et al., 1996); see table 1.1 for examples. The emission rates are then used to determine the lepton number and energy losses, and directly update the energy and composition of the fluid. As the name implies, a leakage scheme only considers the loss of neutrinos from the system, and there is no mechanism for re-absorbing the emitted neutrinos. Generally, these methods work in terms of the energy- or number-averaged rates, but energy- dependent (monochromatic) schemes are also possible, such as the one presented in Perego et al. (2016). Charged-Current e− + p ⇋ νe + n e+ + n ⇋ ¯νe + p Scattering νi + n ⇋ νi + n νi + p ⇋ νi + p Pair Production e− + e+ ⇋ νe + ¯νe γ ⇋ νe + ¯νe Table 1.1: Example neutrino-matter interactions 1.2.1.2 Moment Expansions Another approximate method for including and evolving neutrinos in neutron star merger and core-collapse supernovae simulations is performing a moment expansion over the momentum degrees of freedom in the neutrino distribution function, effectively reducing the momentum degrees of freedom down to a single energy (or equivalently frequency in natural units). A procedure for generating a general relativistic moment expansion for photonic radiation was proposed in Thorne (1981), and has been adapted for use in neutrino radiation transport in many different works, e.g., Shibata et al. (2011); Cardall et al. (2013); O’Connor (2015); Foucart et al. (2015); Roberts et al. (2016); Radice et al. (2022). Formally, the moment expansion is infinite, so the series is typically truncated for a small number of moments. However, the hierarchy of the expansion results in a dependence on moments of higher-rank than the truncation is limited to, requiring a closure relating the 8 higher- to lower-rank moments. Different truncations result in schemes suitable to different types of conditions and problems. The first few moments in the frame of the fluid correspond to physically-meaningful quantities, such as the energy, momentum, and pressure for the zeroth-, first-, and second-rank moments, respectively. Neutrino-matter interactions, such as those in table 1.1, are typically characterized by emissivities and opacities for absorption and scattering processes. Similarly to leakage schemes, moment schemes can also be frequency- averaged or monochromatic. Retaining the zeroth-rank moment for the radiation energy leads to evolution schemes that are closed by relating the radiation momentum (or flux) to the energy. In a flux-limited diffusion scheme as described in Pons et al. (2000), the radiation is assumed to be nearly isotropic in the fluid frame, and behaves diffusively, i.e., its flux is proportional to the gradient of the energy over some diffusive timescale related to the opacity of the material trapping the radiation. Corrections for deviations away from the completely diffusive limit are then made by the addition of an artificial opacity, while a flux-limiter prevents diffusive behavior when the radiation approaches the free-streaming limit. In the M0 scheme, as described in Radice et al. (2016, 2018), free-streaming radiation is assumed to travel along null radial trajectories, such that the flux scales directly with the energy. This type of scheme will typically be matched with a separate treatment for the diffusive limit. Retaining the the zeroth- and first-rank moments for the radiation energy and momentum lead to the widely used M1 scheme. In the M1 scheme, the radiation pressure is specified by interpolation between its diffusive and free-streaming limiting forms. Sharing a similar structure with common hydrodynamics formulations, many of the same numerical methods can be applied to the M1 scheme. The M1 scheme has been used extensively in simulations of core-collapse supernovae, e.g., in O’Connor (2015); Roberts et al. (2016); O’Connor & 9 Couch (2018a,b), and mergers involving neutron stars, e.g., Foucart et al. (2015); Radice et al. (2022). The M1 scheme will be described further in chapter 3. 1.2.1.3 Boltzmann Equation Methods The full evolution of the neutrino distribution function is described by the Boltzmann equa- tion, which relates its temporal, spatial, and momentum changes to the interaction rates of the neutrinos with the fluid. Discretization of the momentum-dependence of the distribution function into discrete angles or rays form the basis of the discrete ordinates, or SN , method. This method can be applied to directly solving the Boltzmann equation for the distribution function, as in Mezzacappa & Bruenn (1993); Mezzacappa & Messer (1999); Liebend¨orfer et al. (2005), or as a means of closing a moment scheme, e.g., by determining the radiation pressure as is done in Asahina et al. (2020). Instead of the typical finite-difference approaches to solving the Boltzmann equation in the preceding examples, particle-based Monte Carlo methods provide an alternative route to evolving the distribution function (see for exam- ple Abdikamalov et al. (2012)). The increased physical detail and accuracy of solving the Boltzmann equation directly incur a higher computational cost than the more-approximate leakage and moment schemes, particularly when additional discretizations of the distribution momentum space by angular grids or representations of the distribution function by parti- cles are coupled to the more-common spatial grid discretizations used in hydrodynamics and spacetime solvers. 1.2.2 Hydrodynamics The fluids in simulations of neutron star mergers and core-collapse supernovae are most eas- ily described by their rest-mass density and a stress-energy tensor describing their energy, 10 momentum, and pressure. The standard approach to evolving these fluids takes the form of a system of conservation and balance laws for the time rate-of-change in the rest-mass, energy, and momentum densities. One of the earliest examples of numerical relativistic hy- drodynamics was applied to gravitational collapse problems in May & White (1966); they derived a system for the fluid equations of motions alongside mass and energy conservation of a similar form presented earlier in Misner & Sharp (1964). Wilson (1972) introduced an Eulerian form of the relativistic hydrodynamics equations that bore a resemblance to common Newtonian formulations. The most common form of the general relativistic hydro- dynamics equations used today was presented in (Banyuls et al., 1997) and is referred to as the Valencia formulation; this formalism will be covered in greater detail in chapter 4. This section will survey three commonly used numerical methods applied to this formalism. 1.2.2.1 Finite-Difference Finite-difference methods have long been used in hydrodynamics simulations. These meth- ods treat the fluid quantities as point-like values on a discrete fixed (Eulerian) or moving (Lagrangian) computational mesh, and use stencil-based approximations of the spatial and temporal derivatives. While generally robust and straightforward to implement, some fea- tures, such as shocks and other discontinuities in the fluid, can prove tricky to resolve without additional numerically- or physically-motivated corrections, or the use of higher-order meth- ods. A high-order finite-difference scheme will be described in chapter 4. While finite-difference methods for relativistic hydrodynamics may not be as widely used as other methods, they have the advantage of being straightforward to implement with high-order schemes. In Zhang & MacFadyen (2006), high-order flux reconstruction coupled with adaptive mesh refinement demonstrates the accuracy and scalability of these methods. 11 Finite-difference methods can also provide a robust and accurate treatment of relativistic magnetohydrodynamics, as shown in Del Zanna et al. (2007). Radice et al. (2014) demon- strate the accuracy of high-order finite-difference methods applied to neutron star mergers. 1.2.2.2 Finite-Volume In contrast to finite-difference methods, finite-volume methods treat the fluid quantities as their averages over discrete cells in a computational mesh. This allows the use of flux- conservative methods to ensure that the flux between cells is exactly conserved, i.e., the flux of density, energy, or momentum leaving one cell is the same as the corresponding flux entering an adjacent cell. The methods used to guarantee flux conservation between cells, which may have a discontinuity at their interface between the adjacent cell-averages, are capable of capturing shocks and similar features in the fluid. Finite-volume methods are commonly used in general relativistic hydrodynamics. Ex- amples of finite-volume methods used in core-collapse simulations include O’Connor & Ott (2010); M¨osta et al. (2014); O’Connor (2015); Roberts et al. (2016); Pajkos (2022). Rezzolla et al. (2010); Radice et al. (2016, 2018) provide examples of finite-volume methods applied to neutron star mergers. 1.2.2.3 Smoothed Particle Hydrodynamics The previous finite-difference and finite-volume methods can present challenges when trying to achieve sufficient resolution of their Eulerian or Lagrangian meshes. Smoothed particle hydrodynamics (SPH) provides an alternative mesh-free Lagrangian discretization that can automatically adapt the resolution to where it is required. The fluid is discretized into (typically) equal-mass particles, from which fluid properties and derivatives are calculated 12 over a local neighborhood of particles. By adapting the size and weights of these calculations, referred to as smoothing kernels, proportionally to the density, each calculation can be made over an equal number of particles. Coupled with a tree-based representation of the particles, this allows for consistent computational costs throughout the domain. Additionally, SPH methods can directly handle regions in vacuum (by not performing calculations there), in contrast to mesh-based methods that typically must impose an artificial marginal-density atmosphere to avoid numerical issues. Examples of SPH methods used in general relativistic hydrodynamics include Rosswog & Davies (2002); Rosswog (2015); Liptai & Price (2019). 1.2.3 General Relativity The evolution of dynamic spacetimes are governed by Einstein’s equations of general relativ- ity relating the curvature of spacetime to its distribution of matter. Accurately describing a dynamic spacetime is essential when dealing with compact objects such as neutron stars and black holes. Numerically, these equations prove challenging to solve, with the whole field of numerical relativity dedicated to tackling these challenges (Baumgarte & Shapiro, 2010). Representing the spacetime in terms of the time and spatial discretizations suitable for numerical simulations can lead to violations of Einstein’s equations due to simplifying assumptions and numerical errors. This section will survey some of the more common ap- proaches used to solve Einstein’s equations. 1.2.3.1 Early Formulations One of the earliest formulations of Einstein’s equations suitable for numerical simulations is referred to as the Arnowitt, Deser, and Misner (ADM) formalism proposed in Arnowitt et al. (1962). This formulation utilizes a 3+1 decomposition of the spacetime (see appendix C for 13 more on this decomposition), and evolves the spatial metric and extrinsic curvature of the spacelike hypersurfaces of the decomposition. This formalism assumes that the Hamiltonian and momentum constraints of Einstein’s equations hold exactly. Unfortunately, outside of some spherically symmetric and axisymmetric spacetimes, this can lead to instabilities due to numerical errors building up constraint violations (Baumgarte & Shapiro, 2010). Other spherically symmetric evolution schemes were introduced in Misner & Sharp (1964); Hernandez & Misner (1966). 1.2.3.2 Constraint solvers Alternatively, the constraint equations can be solved to determine the metric and curvature quantities. A popular method in early simulations of neutron star mergers is the confor- mally flat condition (CFC) used in Wilson & Mathews (1995). Other examples include the waveless approximations in Isenberg (2008), an extended CFC method in Cordero-Carri´on et al. (2009), and a fully-constrained formulation in Bonazzola et al. (2004). All of these methods rely on solving elliptic equations, including vector Laplacian equations. For three- dimensional simulations, these type of elliptic equations can be computationally expensive to solve, and can present challenges in ordering sets of calculations for the spacetime, matter, and radiation. 1.2.3.3 Constraint Damping One of the more common approaches seeks to use the hyperbolic form of the ADM equations while minimizing constraint violation errors via damping or by propagating them out of the computational domain. One of the first methods was proposed by Baumgarte & Shapiro (1998) and Shibata & Nakamura (1995), referred to as BSSN after the authors, and makes a 14 conformal decomposition of the ADM equations. The family of Z4 methods makes use of a modification of Einstein’s equations that includes terms for advecting and damping constraint violations (Gundlach et al., 2005), such that the system of equations reduces to Einstein’s equations when the constraints hold exactly. Two commonly used Z4 formulations include Z4c, a conformal formulation used in Bernuzzi & Hilditch (2010); Ruiz et al. (2011); Cao & Hilditch (2012); Hilditch et al. (2013); Daszuta et al. (2021), and CCZ4, a conformal and covariant formulation used in Alic et al. (2012); Dumbser et al. (2018); Clough et al. (2015); Radia et al. (2022). The Z4 formulation shares a similar structure with the generalized harmonics formulation, an alternative to standard 3+1 formalisms, that has been used in the simulation of binary black hole mergers performed in Pretorius (2005). 1.3 Conventions This work will make use of the common notations used in numerical relativity. Additionally, a system of geometrized units will simplify the presentation of the mathematical formalisms presented in the following chapters. Please refer to appendix A for a full description of these conventions. 15 Chapter 2 Sensitivity to Neutrino Treatment Simulations of neutron star mergers (NSMs) and core-collapse supernovae (CCSNe) are sensitive to the physical approximations made and numerical methods used to model these events. In particular, the treatment of neutrinos can influence the evolution and outcomes of these types of simulations. In the extreme conditions present in NSMs and CCSNe, neutrinos readily interact with matter, and can play a significant role in transporting energy. In the presence of the compact objects and relativistic velocities, neglecting relativistic effects can vastly impact the dynamics of these systems. As such, it is a worthwhile endeavor to determine how and to what extent these approximations and methods can influence the evolution of these systems. Increased detail in the physical models and less-approximate numerical methods can more accurately account for the effects of neutrinos and general relativity, but typically incur significantly larger computational costs. In order to balance these concerns, it is absolutely critical to assess how results change, or stay the same, when using different treatments for neutrinos and their interactions. This chapter will examine the sensitivities of NSM and CCSN simulations to these effects. 2.1 Neutron Star Mergers The material ejected during NSMs can be strongly influenced by the presence of neutrinos. Neutrino winds from a remnant’s accretion disk can drive material out of the system, while the interactions of neutrinos with the ejected material, referred to as ejecta, can alter the 16 material’s composition and impact the nucleosynthesis that occurs there (Radice et al., 2018). However, fully accounting for these neutrino effects in numerical simulations of NSMs proves to be difficult. Neutrinos can be both fully trapped by the high-density material in the remnant objects and free-streaming through less-dense material in the ejecta, requiring the neutrino treatment to handle both of these regimes as well as the transition between them (Foucart, 2023). This section will explore the impact that different neutrino approximation methods make on the properties of and the nucleosynthesis that occurs in the ejecta. The data used for analysis in this section comes from a set of NSM simulations performed in Radice et al. (2018). The simulations use an unequal mass binary with initial neutron star masses Ma = 1.4M ⊙ and Mb = 1.2M ⊙ . Two simulations of this binary separately use a leakage scheme and the M0 moment scheme for the neutrinos. Both simulations make use of the SFHo nuclear equation of state (Steiner et al., 2013a). These simulations are referred to as SFHo M140120 LK and SFHo M140120 M0 for the leakage and M0 schemes, respectively, in table 2 of Radice et al. (2018). The properties of the ejecta are measured at an extraction radius of 300M ⊙ . As a first comparison, fig. 2.1 shows the distribution of velocities within the ejecta. Overall, the M0 scheme produces higher maximum velocities (vmax = 0.91 for M0, vmax = 0.79 for leakage); however, only ∼ 0.025% of the ejecta in the M0 simulation exceed the maximum velocity in the leakage simulation. The leakage scheme has an overall higher average velocity throughout the ejecta ( ⟨ v ⟩ = 0.16 for M0, v ⟨ ⟩ = 0.20 for leakage). While both simulations have similar overall velocity distributions throughout the ejecta, changing only the neutrino treatment does have a small but noticeable impact. The next comparison examines the impact of the neutrino treatment on the composition of the ejecta, in particular the neutron-richness of the material. This is most easily charac- 17 Figure 2.1: Impact of neutrino treatment on ejecta velocities. The fractions of the total ejected mass Mej. at different velocities are compared for the leakage (purple) and M0 (blue) schemes. terized by the electron fraction Ye; the material is more neutron-rich for decreasing values of Ye < 0.5 (Ye = 0.5 indicates an equal number of neutrons and protons). Figure 2.2 shows a comparison of the distribution of mass across a range of Ye from the separate simulations using the leakage and M0 schemes. In contrast with the previous comparison of the ejecta velocities, the difference in the composition between the two schemes is more severe. The leakage scheme leaves a larger fraction of the ejected mass in a more neutron-rich state: 84% of the ejected mass has Ye ∼ 0.2, compared to ≤ ∼ 42% for the M0 scheme. The M0 scheme also produces higher Ye > 0.5 values in a small fraction of the ejected mass. These results follow from one of the primary differences between the two neutrino schemes, the in- clusion or omission of the re-absorption of emitted neutrinos, for the M0 and leakage schemes, 18 0.00.20.40.60.81.0v10−710−610−510−410−310−210−1M/Mej.LeakageM0 Figure 2.2: Impact of neutrino treatment on ejecta composition. The the fractions of the total ejected mass Mej. at different values of the electron fraction Ye are compared for the leakage (purple) and M0 (blue) schemes. respectively. Since there is no mechanism for the ejecta to interact with emitted neutrinos in the leakage scheme, a larger fraction of the ejected material is left in a neutron-rich state. These scheme-dependent compositional differences in the ejecta can further be seen in the predicted r-process nucleosynthesis yields. Figure 2.3 compares the relative abundances of heavier nuclei produced in the ejecta in reference to the measured solar abundances in Anders & Grevesse (1989); Arlandini et al. (1999). These results are calculated during post-processing of the simulation data with the nuclear reaction network SkyNet (Lippuner & Roberts, 2017). The thermodynamic trajectories necessary for integrating the network assume homologous expansion of the ejecta based on the thermodynamic state at the extrac- tion radius. In Radice et al. (2018), we found this approximation works well and produces similar results when compared to nucleosynthesis calculations performed on the trajectories 19 0.00.10.20.30.40.50.6Ye10−610−510−410−310−210−1M/Mej.LeakageM0 Figure 2.3: Impact of neutrino treatment on nucleosynthesis in the ejecta. Predicted abun- dances of r-process nuclei produced in the ejecta are compared for the leakage (purple) and M0 (blue) schemes. Observed solar abundances are included for reference. of a large number of Lagrangian tracer particles in the ejecta. The results for mass numbers A > 130 show similar predictions for both neutrino schemes, but for lower mass numbers the results become more disparate. Figure 2.4 breaks down the contribution of different ranges of Ye values to the predicted yields. These results make use of the actual thermodynamic trajectories as measured by Lagrangian tracer particles in the M0 simulation; tracer particle data is not available for the leakage simulation. Material with higher values of Ye, i.e., the less neutron-rich material, contributes almost exclusively to the lighter r-process nuclei. When viewed in comparison with the Ye distributions in fig. 2.2 and the yields in fig. 2.3, it follows that the overall less neutron-rich ejecta in the M0 simulation produces a larger abundance of these lighter 20 6080100120140160180200A10−410−310−210−1100RelativeAbundancesLeakageM0Solar Figure 2.4: Contributions of different ranges of Ye values to r-process nucleosynthesis in the ejecta. Predicted yields utilize the actual thermodynamic trajectories measured by La- grangian tracer particles in the M0 simulation. Solar abundances are added for reference. r-process nuclei than the more neutron-rich material in ejecta of the leakage simulation. 2.2 Core-Collapse Supernovae Core-collapse supernovae simulations also provide examples of sensitivities to neutrino treat- ment. While simulations of NSMs require a fully general relativistic treatment of the neutri- nos and hydrodynamics due to highly dynamic spacetimes, CCSNe simulations can typically approximate these as gravitational effects through either Newtonian or general relativistic effective potentials (Rampp & Janka, 2002; O’Connor & Couch, 2018a). However, the pres- ence of relativistic velocities, i.e, velocities that are significant fractions of the speed of light, can still impact how neutrinos evolve and interact with matter. 21 6080100120140160180200A10−510−410−310−210−1100RelativeAbundances0.00≤Ye<0.250.25≤Ye<0.350.35≤Ye<0.50TotalSolar Neutrinos and their interactions with matter are most easily described in the co-moving frame of the fluid. Large-scale three-dimensional simulations typically operate with a fixed Eulerian computational frame for evolving neutrinos and the fluid. At relativistic velocities, the differences in how neutrino properties, such as their energy and momentum, are measured in each frame cannot be ignored, and the transformation of these quantities to and from each frame become velocity-dependent. Additionally, when resolving a spectrum of neutrino frequencies, acceleration of the fluid and gravitational effects can cause redshifting effects that impact the number and energy densities of neutrinos of different frequencies. The inclusion or omission of a velocity-dependent neutrino treatment can produce dif- ferent results for the evolution of CCSNe. Figure 2.5 shows a comparison of two-moment neutrino radiation transport methods with and without velocity-dependence in CCSNe sim- ulations performed in O’Connor & Couch (2018b). Their simulations all start from the same progenitor model: the 20M ⊙ model produced by the Modules for Experiments in Stel- lar Astrophysics (MESA) code and presented in Farmer et al. (2016). These simulations were then evolved through collapse and up until 15 ms post-bounce with the GR1D one- dimensional general relativistic hydrodynamics code (O’Connor, 2015), and subsequently evolved in fully three-dimensional simulations performed with FLASH (Fryxell et al., 2000; Dubey et al., 2009). The simulation with a fully velocity-dependent neutrino treatment and one with a neutrino treatment where all velocity-dependent terms were set to zero and the effects of velocity-dependent redshifting were neglected correspond to the mesa20 v LR and mesa20 LR simulations in O’Connor & Couch (2018b), respectively. Figure 2.5 shows the results for the mean radius of the shock at times after bounce, and highlights the effects of the velocity-dependence in the neutrino treatment on the dynamics of the evolving CCSN. The velocity-dependent neutrino treatment produces a faster- and farther-moving shock that 22 subsequently recedes more slowly. Figure 2.5: Comparison of velocity dependence in neutrino treatment for CCSNe simulations. ⟩S at times t after bounce at a time tb are compared for the case The mean shock radii that includes velocity-dependence in the neutrino treatment (purple line) and the case that neglects all velocity terms in the neutrino treatment (blue line). Based on data in O’Connor & Couch (2018b). R ⟨ 23 0.00.10.20.30.40.50.6t−tb[s]020406080100120140160hRiS[km]VelocityDependentVelocityIndependent Chapter 3 General Relativistic Radiation Transport Neutrinos play a crucial role in NSMs and CCNSe, influencing the evolution of the com- position of the matter and providing a mechanism for energy transport. In these highly dynamic systems, neutrinos cannot be assumed to be in equilibrium with the surrounding matter, which necessitates describing the full evolution of each neutrino species distribution and their interactions. Along a trajectory through spacetime characterized by an affine pa- rameter λ, the evolution of the neutrino distribution f f (xa, pa) can be described by the ≡ general relativistic Boltzmann equation (Thorne, 1981) df dλ = dxa dλ ∂f ∂xa + dpi dλ ∂f ∂pi = df dt (cid:20) , (cid:21)coll. (3.1) with spacetime coordinates xa and momentum coordinates pi (where only the spatial com- ponents are necessary since papa = 0 = ⇒ p0p0 = − pipi). The right-hand side of Eq. (3.1) is referred to as the collision integral, and represents the temporal rate-of-change in the neutrino distribution function due to collisions, i.e., interactions between the neutrinos and matter. To better highlight the momentum-dependence in Eq. (3.1), the affine parameter can be defined as d dλ = ( pb ucpc) − ∂ ∂xb , (3.2) where − ucpc = ν are specific values of the neutrino frequencies ν (or equivalently energies 24 in natural units) as measured by a co-moving observer in the frame of the fluid with a four-velocity uc. The change in the spacetime coordinates xa along this affine trajectory immediately follows from Eq. (3.2) as dxa dλ = pa ucpc) . ( − (3.3) A similar change in the momentum coordinates pa can be found by comparison to the geodesic described by d2xa dλ2 + Γa bc dxb dλ dxc dλ = 0, (3.4) where Γa bc are the connection coefficients of the covariant derivative operator (more com- monly referred to as the Christoffel symbols when working with a coordinate basis). Applying Eq. (3.2) to the momentum coordinates pa as defined in Eq. (3.3) then shows that dpa dλ ucpc) = ( − d2xa dλ2 = 1 ucpc) − ( − Γa bcpbpc. (3.5) Making use of Eq. (3.3) and Eq. (3.5) in Eq. (3.1), the evolution of the distribution function becomes pa ∂f ∂xa − abpapb ∂f Γi ∂pi = ( − ucpc) (cid:20) df dt . (cid:21)coll. (3.6) With seven degrees of freedom (1 time + 3 space + 3 momentum) for each neutrino species, tackling Eq. (3.6) directly presents a significant computational challenge. As dis- cussed earlier in chapter 1, methods capable of directly solving Eq. (3.6), e.g., Monte-Carlo 25 particle methods, are computationally intensive and can be difficult to evolve consistently alongside the fluid and the spacetime. One effective way of reducing these degrees of freedom to something more practical is performing a moment expansion of the neutrino distribution function (Thorne, 1981; Shibata et al., 2011). The remainder of this chapter will describe the formulation of and the numerical methods used for a two-moment evolution scheme. The fully general relativistic implementation of this scheme in Flash-X will be presented later in chapter 6. 3.1 Mathematical Formalism 3.1.1 Unprojected Moment Expansion For specific values of neutrino frequencies ν, the neutrino distribution function can be ap- proximated by a monochromatic moment expansion by integrating over the four-momentum degrees of freedom. As applied to photons in Thorne (1981) and later to neutrinos in Shibata et al. (2011), this monochromatic expansion for any arbitrary-rank unprojected moment of the distribution function takes the form M Ak (ν) ≡ M Ak (ν) xb = dV ′p (cid:16) (cid:17) (cid:90) c ν + ucp′ c)k ucp′ δ ( (cid:0) − 2  (cid:1) −  Ak (cid:89)ak∈ f xb, p′ a , (cid:16) (cid:17) ak p′   (3.7) where dV ′p is the invariant volume element of the momentum coordinates p′ a, and Ak = { is the set of indices for the k-th rank moment. This expansion holds only a1, . . . , ak} for the monochromatic case, i.e., only for the specific values of the frequency ν chosen for each moment. For this particular formalism, ν will always be the frequency measured by co-moving observer in the fluid frame, as this is the most practical frame to describe the 26 interaction of neutrinos with the fluid. It is important to note that Eq. (3.7) forms a fully- symmetric tensor for any arbitrary rank that the expansion is specialized to. At times, it will be necessary to measure the total contribution from all neutrino frequencies, and Eq. (3.7) can be integrated over ν (separately for each species) M Ak = ∞ dν M Ak (ν) . 0 (cid:90) (3.8) The evolution of the neutrino distribution function can now be described in terms of this moment expansion. One approach involves applying the moment expansion directly to the Boltzmann equation (Cardall et al., 2013). A second approach proposed in Shibata et al. (2011) relates the covariant divergence of the moment expansion to the Boltzmann equation; this is the approach adopted for this work. By taking the covariant divergence of the moment expansion, the evolution of any arbitrary (k + 1)-th rank moment takes the form (see appendix D for the derivation) ∇bM Akb (ν) − ∂ ∂ν νM Akbc (ν) ∇buc (cid:16) (cid:17) (k − − 1)νM Akbc (ν) ∇buc = S Ak (ν) , (3.9) where ∇b is the covariant derivative operator compatible with the spacetime metric gab. The right-hand side of Eq. (3.9) represents the moment expansion of the collision integral from the Boltzmann equation Ak S (ν) = dV ′p (cid:90) c ν + ucp′ c)k ucp′ δ ( (cid:0) − 2  (cid:1) −  df dt . (cid:21)coll. ak p′  (cid:20)  Ak (cid:89)ak∈ (3.10) By integrating Eq. (3.9) over all frequencies, the evolution of the frequency-integrated mo- 27 ments in Eq. (3.8) follows directly as ∇bM Akb (k − − 1)νM Akbc∇bu = SAk , (3.11) where the frequency-derivative term vanishes under integration since its argument goes to zero at the endpoints ν = 0, . ∞ While Eq. (3.9) and Eq. (3.11) permit evolving any arbitrary-rank moment of the dis- tribution function, a choice of k must be made to further develop a moment evolution formulation. A practical choice is k = 1, leading to a set of evolution equations in terms of the second-rank moment expansion; this moment represents the neutrino stress-energy tensor. In this case, the monochromatic evolution equation takes the form ∇bM ab (ν) − ∂ ∂ν νM abc (ν) ∇buc = Sa (ν), (cid:16) (cid:17) and its frequency-integrated counterpart takes the even simpler form ∇bM ab = Sa. (3.12) (3.13) 3.1.2 Fluid Frame Projections of the Moment Expansion The next step in developing a moment formalism practical for numerical implementation involves decomposing the moment expansion into its irreducible parts. The projections of the moment expansion required for this decomposition will correspond to physically-relatable quantities measured by a co-moving observer in the frame the expansion is defined in. In this case, these projections will most easily be made for the fluid frame, but since the moment 28 expansion and its evolution equation are covariant expressions, these projections can be directly related to the projections in any other frame of reference. To project the moment expansion into the fluid frame, the neutrino four-momentum is decomposed into components parallel and orthogonal to the co-moving observer’s four- velocity, taking the form pa = ( ucpc)(ua + ℓa), − (3.14) where ℓa is a unit normal vector orthogonal to the four-velocity ua, i.e., ℓaℓa = 1 and uaℓa = 0. With this choice of four-momentum, the invariant volume element in Eq. (3.7) takes the form (Thorne, 1981) dVp = ( ucpc) d( ucpc) dΩ , (3.15) − − where dΩ is the differential solid-angle of the momentum coordinates. With these, Eq. (3.7) reduces to M Ak (ν) xb = ν3 dΩ (cid:16) (cid:17) (cid:90)  Ak (cid:89)ak∈  (uak + ℓak ) f(ν),   (3.16) f (xb, ν, Ω). The δ-function in the moment expansion in Eq. (3.7) was eliminated where f(ν) ≡ by integrating over d( − ucpc) to arrive at the factors of ν in Eq. (3.16). For this form of the moment expansion, the first few projected moments are defined as J(ν) = ν3 dΩ f(ν), (3.17) (cid:90) 29 Ha (ν) = ν3 dΩ ℓaf(ν), (ν) = ν3 Lab (ν) = ν3 N abc (cid:90) (cid:90) (cid:90) dΩ ℓaℓbf(ν), dΩ ℓaℓbℓcf(ν). (3.18) (3.19) (3.20) The first three projected moments correspond to the radiation energy density, momentum density, and pressure tensor associated with neutrinos of a monochromatic frequency ν. Specializing Eq. (3.16) to the k = 2 case, the second-rank moment can be written in terms of the projections in Eqns. (3.17)–(3.20) as M ab (ν) = ν3 dΩ (cid:90) uaub + uaℓb + ubℓa + ℓaℓb (cid:104) f(ν) = J(ν)uaub + Ha (ν)ub + Hb (cid:105) (ν)ua + Lab (ν). By a similar process, the third-rank moment expansion can be expressed as M abc (ν) = J(ν)uaubuc + Ha (ν)ubuc + Hb (ν)uauc + Hc (ν)uaub + Lab (ν)uc + Lac (ν)ub + Lbc (ν)ua + N abc (ν) . (3.21) (3.22) Examining the structures of Eq. (3.16) and Eqns. (3.21)–(3.22) shows that each higher- rank moment fully contains each lower-rank moment in the hierarchy. This fact can be exploited to obtain the projected moment of any rank from the unprojected moment of equal or higher rank. To demonstrate this, first note that the projected moments of rank greater than zero are orthogonal to the co-moving observer’s four-velocity ua since uaℓa = 0, e.g., uaLab = 0, and thus are spacelike in this local frame. Using this in Eq. (3.16) then 30 shows that ubM Akb (ν) = M Ak (ν) . − (3.23) Next, define the projection operator orthogonal to ua as hab = gab + uaub, (3.24) where gab is the spacetime metric; this operator can also be viewed as the local spatial metric in the observer’s restframe. With Eq. (3.24), the projected components of Eq. (3.16) relate to lower-rank moments in the expansion as hb and its trace as cM Akc (ν) = M Akb (ν) − ubM Ak (ν) , hbcM Akbc (ν) = M Ak (ν) . (3.25) (3.26) The projected moments can now be obtained directly from the unprojected moments by making use of the identities in Eq. (3.23) and Eq. (3.25) in comparison to the expansion in Eq. (3.16) and the projected moments in Eqns. (3.17)–(3.20). For the zeroth- through third-rank projected moments that are seen in Eqns. (3.21)–(3.22), their relations to the moment expansions of equal or higher rank are J(ν) = M(ν)= − uaM a (ν) = uaubM ab (ν) = uaubucM abc (ν) − (3.27) 31 Ha (ν) Lab (ν) N abc (ν) = ha bM b (ν) = ha bucM bc (ν) = ha bucudM bcd (ν) − = ha chb dM cd (ν) = ha chb dueM cde (ν) − = ha dhb ehc f M def (ν) . (3.28) (3.29) (3.30) Making similar projections of the moment evolution equation into components parallel and orthogonal to the co-moving observer’s four-velocity will lead to a system of evolution equations for the projected moments. Unfortunately, using the decomposition of the moment expansion in terms of the co-moving frame projected moments from Eq. (3.21) directly in Eq. (3.12) does not produce flux-conservative evolution equations, even in the absence of neutrino-matter interactions. A flux-conservative formulation is a desirable property for maintaining energy and momentum conservation, facilitating consistent and stable numerical implementations. As such, the co-moving frame projections of the evolution equations will not be considered any further in this chapter; please refer to Shibata et al. (2011) for a more detailed examination of these equations. 3.1.3 Eulerian Frame Projections of the Moment Expansion The decomposition of the moment expansion and the moment evolution equations are co- variant tensor expressions and are valid in any frame of reference for any choice of coordinate system (although the frequency is specific to the frame that the expansion is defined in). This allows freedom in choosing a frame of reference that is suitable for numerical compu- tations. A choice widely used for dynamic spacetime and fluid evolution is a fixed Eulerian frame as viewed by an infinitely distant observer. In this frame, a ‘3+1’ decomposition of the spacetime is made into spacelike hypersurfaces at constant coordinate times. Please 32 refer to appendix C for an overview of this decomposition that will be used throughout the remainder of this chapter. In a similar manner as the projections made in the co-moving frame, the unprojected moment expansion can be decomposed into components parallel and orthogonal to the four- velocity of an Eulerian observer – this four-velocity corresponds to the timelike normal direction of the spacelike hypersurfaces. Let na be the Eulerian four-velocity, such that nana = 1. A projection operator onto the spacelike hypersurfaces immediately follows by − comparison to Eq. (3.24) γab = gab + nanb, (3.31) which also plays the role of the metric on the spacelike hypersurfaces. With these, the second- rank unprojected moment can be decomposed in terms of na and Eulerian projections of the moments (which are defined in terms of the following expression) M ab (ν) = E(ν)nanb + F a (ν)nb + F b (ν)na + P ab (ν). (3.32) As was the case for the co-moving frame projections, the Eulerian projections correspond to the energy density E(ν), momentum density F a (ν), and pressure tensor P ab (ν) of the neutrinos as measured by the Eulerian observer. Making use of the Eulerian four-velocity and projection operator, the projected moments can be found from Eq. (3.32) E(ν) = nanbM ab (ν) F a (ν) = γa bncM bc (ν) − 33 (3.33) (3.34) (ν) = γa P ab cγb dM cd (ν), (3.35) which follows from naF a (ν) = naP ab (ν) = 0. An immediate complication posed by the Eulerian projections is that the neutrino fre- quency ν that these moments are specific to is not, in general, the same as the frequency measured by the Eulerian observer. Neutrino-matter interactions and redshifting effects, such as those caused by acceleration of the fluid, are most easily defined in the fluid frame, so it is necessary to relate the co-moving frame projected moments to their Eulerian coun- terparts. To accomplish this, the co-moving observer’s four-velocity can be decomposed into components parallel to the fluid’s spatial velocity va and the Eulerian four-velocity na ua = W (na + va), (3.36) where W = − uana, commonly referred to as the Lorentz factor, quantifies the relative velocity difference between the two observers. From the normalization and orthogonality conditions uaua = nana = 1 and nava = 0, the usual definition of the Lorentz factor W = − 1/ 1 − vivi is recovered from Eq. (3.36). Using Eq. (3.32) and Eq. (3.36) in Eqns. (3.27)– (cid:112) (3.28) then gives the relation of the co-moving frame energy and momentum densities to the Eulerian frame projected moments J(ν) = W 2 E(ν) − (cid:16) (ν) = W F a (ν) + W Ha 2viF i (ν) + vivj P ij (ν) E(ν) + viF i (ν) na (cid:16) (cid:17) , (cid:17) − J(ν)ua − W viP ia (ν). (3.37) (3.38) Now the moment evolution equation can be brought into a more tractable form. Inserting 34 the Eulerian decomposition of Eq. (3.32) into Eq. (3.12) and taking projections parallel and orthogonal to the Eulerian observer’s four-velocity yields (see appendix D for a full derivation) and ∂ ∂t ˜E(ν) (cid:104) (cid:105) + ∂ ∂xj α ˜F j (cid:104) (ν) − = α (cid:20) βj ˜E(ν) + (cid:105) ˜P ij (ν)Kij − ∂ ∂ν ναna ˜M abc (ν) ∇buc ˜F i (ν) (cid:104) ∂ ln α ∂xi − na ˜Sa (ν) (cid:105) , (cid:21) (3.39) ∂ ∂t (cid:104) ˜Fi,(ν) + (cid:105) = α ∂ ∂xj α ˜P j i,(ν) − βj ˜Fi,(ν) (cid:104) ˜P jk (ν) 2 ∂γjk ∂xi + ˜Fk,(ν) α ˜M abc (ν) ∇buc ∂ ∂ν ναγia (cid:104) ˜E(ν) ∂ ln α ∂xi + na − (cid:105) ∂βk ∂xi −   (cid:105) ˜Sa , (ν)  (3.40) where the 3+1 split spacetime quantities are the lapse function α, shift vector βi, and the extrinsic curvature of the spacelike hypersurfaces Kij. In the preceding equations, the tilde- quantities represent the densitized form of the corresponding moment, e.g., ˜E(ν) ≡ where γ = det γij is the determinant of the spatial metric and quantifies the local volume √γE(ν), element in the Eulerian frame. These evolution equations form a hyperbolic system in a flux-conservative form, and must be solved for each neutrino species and frequency. In both Eqns. (3.39)–(3.40), the ν-derivative terms encapsulate the effects of velocity- and gravitational-dependent redshifting, and represent a “flux” along the neutrino frequency degree-of-freedom. These terms, along with some types of neutrino-matter interactions such as inelastic scattering on electrons, serve to tightly couple the systems of evolution equations between the neutrino frequencies. Since the Eulerian projection of the moments and the evolution equation are for specific 35 frequencies defined in the co-moving frame, their frequency-integrated forms follow in the exact same manner as E = F a = P ab = ∞ dν E(ν) ∞ dν F a (ν) ∞ dν P ab (ν) 0 (cid:90) 0 (cid:90) 0 (cid:90) and ∂ ∂t ˜E + ∂ ∂xj ∂ ∂t ˜Fi (cid:104) (cid:105) + (cid:104) ∂ ∂xj (cid:105) α ˜P j (cid:104) i − α ˜F j (cid:104) βj ˜Fi βj ˜E − = α ˜P ijKij − (cid:20) ˜Fk ∂βk ∂γjk ∂xi + ∂xi − α (cid:105) ˜P jk 2 = α (cid:34) (cid:105) ˜F i ∂ ln α ∂xi − ˜Sa na (cid:21) ∂ ln α ˜Sa ∂xi + na ˜E (3.41) (3.42) (3.43) (3.44) (3.45) . (cid:35) As was the case with the frequency-integrated moment evolution equation in Eq. (3.11), the terms containing frequency-derivatives vanish under integration. This frequency-integrated form of the evolution equations will not be considered any further, and the explicit ν- subscript will be omitted for the remainder of this chapter in order to simplify notation. All neutrino quantities will be assumed to be frequency-dependent unless otherwise stated. 3.1.4 Closure Relation Since the evolution equations for the energy density and momentum density result from projections of the second-rank moment’s evolution equation, knowledge of the higher-rank projections are necessary. The higher-rank moments are also necessary when relating the co-moving frame projections to the evolved Eulerian frame projections. Since the moments 36 of second-rank and higher are not directly evolved (these would also always require the next- highest rank moments), the pressure tensor P ab must be provided to close the system in Eqns. (3.39)–(3.40). The common approach in this type of two-moment evolution scheme, also referred to as an M1 scheme, is to approximate the pressure tensor by interpolation between the optically thin and thick limiting forms that can be specified in terms of the energy and momentum densities. Since neutrino-matter interactions ultimately determine how optically thin or thick the fluid is, this determination must be made in the co-moving frame. For the M1 formulation, the interpolation takes the form Lab = 3χ(ξ) 2 1 − Lab thin + 3(1 χ(ξ)) − 2 Lab thick, (3.46) where χ(ξ) is a closure function of the parameter ξ that characterizes how optically thin or thick the fluid is, and Lab thin and Lab thick are the optically thin and thick, respectively, limiting forms of the co-moving frame pressure tensor. A closure function may be freely chosen (see Murchikova et al. (2017) for a comprehensive list and comparison of commonly used closures), but it must take on the following limiting values to correctly reproduce these limiting forms χ(ξ) = 1 3 (Optically Thick), χ(ξ) = 1 (Optically Thin), lim 0 ξ → lim 1 ξ → (3.47) where the parameter ξ ranges from zero to one in the optically thick and thin limits, respec- tively. One effective way to define ξ such that these limits are met is by the ratio of the magnitude of the momentum density to the energy density as measured in the co-moving 37 frame (Shibata et al., 2011) ξ2 = habHaHb J 2 . (3.48) In the co-moving frame, this form correctly sets ξ = 0 in the optically thick limit where the radiation is isotropic. Defining ξ in terms of the Eulerian quantities cannot guarantee this limit since completely trapped neutrinos in a moving fluid will not necessarily be observed as isotropic in the Eulerian frame, i.e., γijF iF j = 0 as the neutrinos will have non-zero momentum in this frame due to the advection of the fluid. The structure of the moment expansion in terms of the projected moments allows the interpolation in Eq. (3.46) to be used for the other projected moments as well. By using Eq. (3.46) in Eq. (3.21) and then taking the projection Eq. (3.35), the Eulerian frame pressure tensor can also be expressed as P ab = 3χ(ξ) 2 1 − P ab thin + 3(1 χ(ξ)) − 2 P ab thick. (3.49) By making use of both Eq. (3.46) and Eq. (3.49), the co-moving frame energy and moment densities can then be found in terms of E, F i, and ξ via Eqns. (3.37)–(3.38). Higher-rank moments, such as N abc, can also be expressed as interpolations between their optically thin and thick limiting forms, e.g., N abc = 3χ(ξ) 2 1 − N abc thin + 3(1 χ(ξ)) − 2 N abc thick. (3.50) The remainder of this section will focus on obtaining the limiting forms of the pressure tensor in both frames. A list of practical expressions of the co-moving frame energy and 38 ̸ momentum densities suitable for numerical implementation are provided in appendix E. 3.1.4.1 Optically Thin Limit In the optically thin limit, neutrinos are free-streaming in a vacuum or non-interacting fluid, and are assumed to be traveling at the speed of light. As massless particles (to good approximation), free-streaming neutrinos will follow null trajectories, i.e., their four- momenta obey papa = 0. As such, the magnitude of the neutrino momentum will always equal the neutrino energy, from which it follows J = H = habHaHb, Ha = J E = F = (cid:113) γabF aF b, (cid:113) F a = E Ha H F a F = J ˆha, = E ˆf a, (3.51) (3.52) where H and F are the magnitudes of the neutrino momentum in the co-moving and Eule- rian frames, respectively, and ˆha and ˆf a are unit vectors in the streaming direction of the neutrinos in the co-moving and Eulerian frames, respectively. Based on the relations in Eq. (3.51), any expression for the optically thin pressure tensor in the co-moving frame can only depend on the energy density and the streaming direction. Using Eq. (3.21) in Eq. (3.26) further constrains the trace of the pressure tensor to be habLab = J. With both of these constraints, a suitable form of the pressure tensor is thin = J ˆhaˆhb. Lab 39 (3.53) (3.54) By a similar argument, since the neutrino momentum as observed in the Eulerian frame does not contain any contribution from the motion of the fluid in the optically thin limit, the Eulerian frame pressure tensor can also be written as thin = E ˆf a ˆf b. P ab (3.55) Alternative formulations of the Eulerian frame pressure tensor exist; see Shibata et al. (2011) for a further discussion of these forms (including the one used here) and potential issues posed when using these in the closure interpolation. The third-rank projected moment can be found by using Eq. (3.54) in Eq. (3.22) and using the trace condition in Eq. (3.26) to show that hbcN abc thin = J ˆha. (3.56) As with the second-rank moment, it will be necessary to express the third-rank projection only in terms of the energy density and momentum density. Making use of the identity hab ˆhaˆhb = 1, a straightforward extension of the procedure used to obtain the second-rank projected moment gives the third-rank projected moment of the form thin = J ˆhaˆhbˆhc. N abc (3.57) 3.1.4.2 Optically Thick Limit In the optically thick limit, the neutrinos are completely trapped by the fluid, leading to an isotropic distribution. To satisfy the trace condition in Eq. (3.26) and Eq. (3.53) in the 40 optically thick limit, the co-moving frame pressure tensor must take the form Lab thick = hab. J 3 (3.58) Applying the trace condition in Eq. (3.26) to the third-rank moment expansion in Eq. (3.22) with Lab given by Eq. (3.58) shows that the third-rank projection’s trace must satisfy hbcN abc thick = Ha. (3.59) To preserve the isotropic character of the neutrino radiation, a suitable form for the third- rank projected moment in the optically thick limit is N abc thick = 1 5 (cid:16) Hahbc + Hbhac + Hchab . (3.60) (cid:17) Unlike the optically thin limit, the Eulerian frame pressure tensor cannot be specified in as straightforward of a manner, as the radiation is not necessarily isotropic in this frame. Instead, it must be obtained from the projection of the optically thick limiting form of the second-rank moment expansion M ab thick = Juaub + Haub + Hbua + hab J 3 + Haub + Hbua. = J 3 (cid:16) gab + 4uaub (cid:17) (3.61) Using Eq. (3.61) in Eq. (3.35) gives the optically thick form of the Eulerian pressure tensor P ij thick = J 3 γij + 4W 2vivj (cid:16) (cid:17) + W ¯Hivj + ¯Hjvi , (cid:16) (cid:17) (3.62) 41 where ¯Hi = γi aHa is the Eulerian spatial projection of the co-moving frame momentum density1, and Eq. (3.31) and Eq. (3.36) were used to expand gab and ua, respectively. An immediate complication with this form of the Eulerian frame projection is the energy and moment densities in the co-moving frame must now be expressed in their optically thick limiting forms in terms of their known Eulerian counterparts. To find these expressions, Eq. (3.62) can be used in the projections in Eqns. (3.27)–(3.28) to show that 1 3 E = F i = (cid:16) 4 3 (cid:18) 4W 2 1 Jthick + 2W viHi thick, − (cid:17) W 2Jthick + W viHi thick vi + W ¯Hi thick, (cid:19) (3.63) (3.64) where Jthick and Ha thick are the optically thick limiting forms of the co-moving frame energy and momentum densities, respectively. Inverting these expressions for the co-moving frame projections continues by contracting Eq. (3.64) with the spatial velocity vi, then solving for the W viHa term, and finally using the result in Eq. (3.63) to find Jthick = ¯Hi thick = 2W 2 3 2W 2 + 1 F i W − (cid:104)(cid:16) W 2W 2 + 1 1 E − (cid:17) 4W 2E − − (cid:104) 2W 2viF i , (cid:105) 4W 2 + 1 (cid:16) (cid:17) vkF k vi. (cid:105) (3.65) (3.66) Using the expressions in Eqns. (3.65)–(3.66) in Eq. (3.62) then gives the optically thick limiting form of the Eulerian pressure tensor P ij thick = 1 2W 2 + 1 2W 2 2W 2 + 1 − (cid:104)(cid:16) 2W 2 2E − (cid:104) − 1 E − (cid:17) vkF k 2W 2vkF k γij (cid:105) vivj + F ivj + F jvi. (cid:105) (3.67) 1Barred co-moving frame quantities will always represent their Eulerian frame spatial projections. 42 3.1.5 Redshifting Effects The frequency of the neutrinos in the co-moving frame can change due to both the acceler- ation and shear of the fluid, as well as the curvature of the spacetime. These velocity- and gravitational-induced redshifting effects are captured in the frequency-derivative terms in the evolution equations by the projection of the third-rank moment expansion onto the covariant derivative of the co-moving observer’s four-velocity. While this can be done in the co-moving frame, it is simpler to perform these calculations in the Eulerian frame where the evolved neutrino energy and momentum densities, fluid velocity, and metric quantities are defined. By making use of the Eulerian decomposition of the co-moving observer’s four-velocity in Eq. (3.36), its covariant derivative takes the form ∇buc = ∇b[W (nc + vc)] = W ∇bnc + nc ∂W ∂xb + ∇b(W vc). (3.68) Unlike the co-moving frame moment-expansion which can readily be defined by its irre- ducible parts, e.g., J is the zeroth-rank part of both the second- and third-rank expansions, the same hierarchy does not generally hold for the Eulerian frame decompositions. Instead, following the method presented in Cardall et al. (2013), the third-rank moment expansion can be defined in terms of different Eulerian zeroth- through third-rank projections, taking the form M abc = Qnanbnc + Ranbnc + Rbnanc + Rcnanb Sabnc + Sacnb + Sbcna + T abc, (3.69) where, similarly to the projections of the Eulerian second-rank moment-expansion, the pro- 43 jections of first-rank and higher are purely spatial, i.e., naRa = naSab = naT abc = 0. With this definition, the projected moments can be found in terms of the co-moving frame projections as Q = − Ri = γi nanbncM abc = W 3J + 3W 2vi ¯Hi + 3W vivj ¯Lij + vivjvkN ijk, anbncM abc = W 3J + 2W 2vj ¯Hj + W vjvk ¯Ljk vi + W 2 ¯Hi (cid:104) + 2W vj ¯Lij + vjvk ¯N ijk, (cid:105) Sij = γi aγj bncM abc = − W 3J + W 2vk ¯Hk (cid:104) + W 2 ¯Hj + W vk vivj + (cid:105) ¯Ljk (cid:104) W 2 ¯Hi + W vk ¯Lik vj (cid:105) vi + W ¯Lij + vk ¯N ijk, (3.70) (3.71) (3.72) T ijk = γi aγj bγk (cid:104) cM abc = W 3Jvivjvk + W 2 (cid:105) ¯Hivjvk + ¯Hjvivk + ¯Hkvivj + W (cid:104) ¯Lijvk + ¯Likvj + ¯Ljkvi (cid:104) (cid:105) + ¯N ijk, (cid:105) (3.73) where the barred-quantities are again the Eulerian spatial projections of the co-moving frame moments. In general, Q, Ri, and Sij are not the same as the similar-rank projections of the second-rank moment expansion. They are only equivalent for the trivial case of vi = 0, such that both observers have the same four-velocity, ua = na, and the projected moments in each frame take on the same values. With the Eulerian decompositions of the covariant derivative of the four-velocity in Eq. (3.68) and the third-rank moment in Eq. (3.69), the contraction at the core of the redshifting term in the evolution equations becomes a straightforward (but lengthy) exercise in tensor algebra, resulting in (see appendix D.3 for the derivation) M abc∇buc = 0 C{ − }(Qna + Ra) C{ 1 }i − C{ 2 }ij (cid:16) − (cid:17) Sijna + T aij . (3.74) (cid:17) Rina + Sai (cid:16) 44 The tensor coefficients in Eq. (3.74) are 0 C{ } = 1 C{ }i = na ∂W ∂xa (cid:20) ∂W ∂xi − (cid:20) (cid:21) na ∂W vi ∂xa (cid:21) + + W vk ∂ ln α ∂xk (cid:20) , (cid:21) ∂ ln α ∂xi − W (cid:34)− W vk α ∂βi ∂xk (cid:35) , 2 C{ }ij = ∂W vi ∂xj (cid:21) − (cid:20) + W Kij − (cid:34) W vk 2 ∂γij ∂xk (cid:35) , (3.75) (3.76) (3.77) where the terms in the left brackets characterize the acceleration and shear of the co-moving observer, and the terms in the right brackets characterize the curvature of the spacetime. The timelike and spacelike projections in Eqns. (3.39)–(3.40) trivially follow as 1 }i Ri + C{ 0 naM abc∇buc = C{ }Q + C{ 1 }j Sj 0 γiaM abc∇buc = C{ }Ri + C{ 2 }ij Sij 2 }jk T jk i . i + C{ − (3.78) (3.79) When the spatial and temporal gradients of the velocity are zero, a non-flat spacetime will still lead to a “flux” between the neutrino frequencies. This effect is even present in vacuum or when there is no finite velocity, as the contraction of the higher-rank projections with the extrinsic curvature Kij may still be non-zero. The redshifting effects will only vanish in the frequency-dependent evolution equations for the trivial case of a flat spacetime and a zero background fluid velocity. 3.1.6 Neutrino-Matter Interactions The collision integral in the Boltzmann equation, and consequently its moment-expansion form, determines the rate-of-change in the underlying neutrino distribution due to the in- 45 teraction of neutrinos with the fluid. In the second-rank evolution equations, Eqns. (3.39)– (3.40), the moment-expansion source vector Sa (ν) characterizes the transfer of energy and momentum from neutrinos of frequency ν to the fluid. To maintain energy and momentum conservation, the net transfer of energy and momentum of all neutrino species over the full frequency spectrum must also be accounted for in the evolution of the fluid’s energy and momentum densities. The total interaction source vector is then Sa tot. = 0 σ (cid:90) (cid:88) ∞ dν Sa (σ,ν), (3.80) where the additional subscript σ in the summation is over all neutrino species. For a hy- drodynamics formulation similar in structure to the moment evolution equations, i.e., a formulation based on the covariant divergence of the fluid’s stress-energy tensor, the fluid’s energy and momentum evolution equations will contain the timelike and spacelike projec- tions, respectively, of Eq. (3.80), but with an opposite sign as those in Eqns. (3.39)–(3.40). The source vector takes on different forms for different types of neutrino-matter interac- tions. To simplify the analysis and facilitate adding new types of interactions, the interaction source will be separated into terms representing different processes, Sa = Sa ea + Sa iso, (3.81) where “ea” denotes emission and absorption of neutrinos by the fluid, and “iso” denotes isoenergetic scattering of neutrinos off of nucleons and nuclei. The remainder of this section will describe the form that each of these terms takes. The notation used in Rampp & Janka (2002); Shibata et al. (2011) of B [df /dt]coll. for the collision integral will be ≡ 46 used throughout, where the explicit subscripts for the neutrino frequency and species will be suppressed for readability. 3.1.6.1 Emission and Absorption Emission and absorption of neutrinos result from electron-capture type processes such as νe + n ⇋ e− + p. The total rate of the sum of these processes can be characterized by an emissivity j and the mean-free path of the neutrinos λ. Since neutrinos are fermions, the reaction rates for all of these processes will be subject to final-state Pauli blocking, also referred to as stimulated absorption (Rampp & Janka, 2002; Burrows et al., 2006), and the collision integral takes the form (Bruenn, 1985) Bea = j(1 f ) − − f λ , (3.82) where f ≡ f (ν, Ω) is the frequency-dependent neutrino distribution function that appears in the Boltzmann equation and moment-expansion. The emissivity and mean-free path are assumed to only depend on the frequency ν of the neutrinos, but not on the direction of the momentum Ω. This form of the collision integral suggests a total absorption opacity (Rampp & Janka, 2002) κabs = j + 1 λ , such that the collision integral takes the form Bea = j κabsf. − 47 (3.83) (3.84) The emissivity can now be brought into a form more suitable for use in the moment-expansion of the collision integral. When Bea = 0, such that absorption and emission rates are balanced, the neutrinos will be in thermal equilibrium with the fluid, and described by an equilibrium Fermi-Dirac distribution (Burrows et al., 2006) feq = 1 e(ν µν )/T + 1 − , (3.85) where µν is the chemical potential of the neutrinos (which goes to zero in the β-equilibrium case). It immediately follows that the emissivity can be expressed as j = κabsfeq, (3.86) and the collision integral then takes the form Bea = κabs feq (cid:0) f . − (cid:1) (3.87) The form of the collision integral is aptly suited for use in the moment-expansion of the collision integral in Eq. (3.10). By defining the equilibrium energy density in the co-moving frame by using Eq. (3.85) in Eq. (3.17) as Jeq = ν3 dΩ feq, (cid:90) (3.88) and assuming that the neutrino radiation is completely isotropic such that Ha eq = 0, perform- ing the first-rank expansion of the collision integral for emission and absorption processes 48 leads to the source vector ea = κabsJequa Sa κabs(Jua + Ha) − = κabs Jeq J ua − − κabsHa. (cid:0) (cid:1) (3.89) 3.1.6.2 Isoenergetic Scattering When neutrinos scatter off of much heavier nucleons and nuclei, there is no assumed energy exchange (Bruenn, 1985), so these scattering processes are elastic. To analyze these processes, it will be useful to simplify the integrals over the angular degrees-of-freedom by defining the unit vector in the spatial direction of the momentum as ℓi = (cos ϕ sin θ, sin ϕ sin θ, cos θ), for polar and azimuthal angles θ and ϕ, respectively, such that the integrals take the form dΩ → (cid:90) 1 2π dµ dϕ , 1 − (cid:90) 0 (cid:90) (3.90) where µ = cos θ. The total isoenergetic scattering rate must account for all possible incoming and outgoing scattering angles, and when accounting for initial and final state blocking takes the form (Bruenn, 1985; Shibata et al., 2011) Biso = ν2 1 2π dµ′ 0 (cid:90) 1 (cid:90) − dϕ′ f ′ − (cid:2) f Riso(ω), (cid:3) (3.91) f (ν, Ω′) and Riso(ω) is the isoenergetic scattering kernel as function of the angle where f ′ ≡ between the incoming and outgoing neutrino directions ω = µµ′ + cos ϕ (cid:0) ϕ′ − 1 (cid:1)(cid:113)(cid:0) − µ2 1 2 µ′ . − (cid:1)(cid:0) (cid:1) (3.92) 49 A commonly taken approach is to expand the scattering kernel in powers of ω, retaining only up to the terms linear in ω, and the distribution function in powers of ℓa up to second- rank (Shibata et al., 2011) Riso ≈ iso + ωR1 R0 iso, and f ≈ f 0 + f 1 a ℓa + f 2 abℓaℓb, (3.93) (3.94) where the coefficients with numeric superscripts are all independent of the angle. With these definitions, using Eqns. (3.92)–(3.94) in Eq. (3.91) shows that Biso = 4πν2 1 3 (cid:20) isof 1 R1 a ℓa − R0 iso f 1 a ℓa + f 2 abℓaℓb (cid:16) . (cid:17)(cid:21) (3.95) With this form of the isoenergetic scattering collision integral, its first-rank moment expan- sion evaluates to iso = 4πν2 Sa 1 3 R1 iso − (cid:20) R0 iso Ha, (cid:21) (3.96) where the terms proportional to ℓa and ℓaℓbℓc go to zero under integration over dΩ in the expansion. By defining the isoenergetic scattering opacity as κiso = 4πν2 R0 iso − 1 3 (cid:20) R1 iso , (cid:21) (3.97) 50 Eq. (3.96) can be simply written as Sa iso = κisoHa. − (3.98) 3.1.6.3 Full Form of the Neutrino-Matter Interaction Source Terms With the expansions of the collision integral given Eq. (3.89) and Eq. (3.98), the moment expansion of the full collision integral is then Sa = κabs Jeq J ua − − (κabs + κiso)Ha. (cid:0) (cid:1) (3.99) The projections necessary for the evolution equations, Eqns. (3.39)–(3.40), are then trivially found as naSa = W κabs − γiaSa = W κabs Jeq (cid:0) Jeq (cid:0) + (κabs + κiso)naHa, (κabs + κiso) ¯Hi, vi − J J − − (cid:1) (cid:1) (3.100) (3.101) With this formulation, all details of the reaction rates based on the properties of the fluid are encapsulated in the absorption and isoenergetic scattering opacities. This allows greater flexibility in choosing which interactions are included without having to change the form of these source terms in the evolution equations. 3.2 Numerical Methods This section will describe the numerical methods used for solving the moment evolution equations. Implementation details of the solver developed for Flash-X will be covered later 51 in chapter 6. To better illustrate these methods, Eqns. (3.39)–(3.40) will be written as ∂tU + ∂j Fj(U) + ∂ν R(U) = G(U) + S(U), (3.102) where ∂t ≡ ∂/∂t , ∂j ≡ ∂ ∂xj , and ∂ν ≡ (cid:14) ∂/∂ν . The vector of evolved variables is U =  ˜E .    ˜Fi   The remaining terms are all treated as functions of the evolved variables, with α ˜F j Fj(U) =  α ˜P j   − i − βj ˜E βj ˜Fi ,    representing advection in the j-th spatial direction, R(U) = να na ˜M abc∇buc γia ˜M abc∇buc ,    −   representing advection along the frequency “axis” of the neutrinos, G(U) = α   1 2 ˜P jkKjk − ˜P jk∂iγjk + α− ˜F i∂i ln α 1 ˜Fj ∂iβj ˜E∂i ln α − ,    (3.103) (3.104) (3.105) (3.106) representing geometric source terms resulting from the covariant divergence, and finally ˜Sa na − γia ˜Sa S(U) = α   52 ,    (3.107) representing the energy and momentum exchange due to interactions between neutrinos and the fluid. The remainder of this section will cover the methods used for solving the closure relation and performing temporal, spatial, and frequency discretizations of each of the terms in Eq. (3.102). 3.2.1 M1 Closure Closing the evolution equations and interpolating the co-moving frame quantities requires specifying a closure function χ(ξ). As mentioned earlier in this chapter, the closure function must be able to reproduce both the optically thin and thick limiting forms of the co-moving frame pressure tensor, but is otherwise freely specifiable. There are many different closure functions commonly used in two-moment evolution schemes, which all take different ap- proaches to arrive at a functional form of χ(ξ), ranging from simple weighted averages, to multi-parameter fits of analytic models or direct solutions of the Boltzmann equation, e.g., from Monte Carlo particle methods. For a comprehensive list and comparison of widely used closure functions, please refer to Murchikova et al. (2017). The implementation described in this chapter will make use of the maximum-entropy Minerbo closure (Minerbo, 1978; Cernohorsky & Bludman, 1994) χ(ξ) = 1 3 + 2ξ2 15 3ξ2 − (cid:16) ξ + 3 . (cid:17) (3.108) This form of the closure results from maximizing the entropy as a functional of the distri- bution function, and has a simple polynomial form. The Minerbo closure is widely used in general relativistic neutrino radiation transport codes; see Foucart et al. (2015); Radice et al. (2022); Cheong et al. (2023) for examples. 53 Obtaining the pressure tensor and various co-moving frame projected moments from their closure interpolations requires solving Eq. (3.48) for the closure factor ξ. Unfortunately, Eq. (3.48) is implicit in the closure factor, as both J and Ha must be interpolated between the optically thin and thick limiting forms via the closure. As such, ξ must be solved for numerically. First, Eq. (3.48) is transformed into the function (ξ) = [J(ξ)]2ξ2 habHa(ξ)Hb(ξ), − G (3.109) where the dependence of the co-moving frame energy and momentum densities on the closure factor is shown explicitly. Solving for the closure factor now reduces to finding the numerical root of G (ξ) = 0. Since the closure factor is always in the range 0 ξ ≤ ≤ 1, the bracketed Brent root-finding algorithm (Brent, 2002) is used to solve Eq. (3.109) for every new set of E and F i. A Newton-Raphson iterative method can converge on a solution faster with an adequate initial guess, e.g., a previous known value of ξ, or F/E in the zero-velocity limit, but in practice struggles to converge in the limit of relativistic velocities near the boundaries ξ = 0, 1. 3.2.2 Spatial Advection The spatial advection operator ∂j F(U) makes use of either a finite-volume or finite-difference discretization. The finite-volume discretization is well suited for the flux-conservative form of Eq. (3.102), and works well with the cell-centered mesh utilized by Flash-X. The alternative finite-difference discretization seeks parity with the finite-difference hydrodynamics scheme (see chapter 4), and performs comparably to its finite-volume counterpart. This section will describe the eigenstructure of the spatial advection operator and the 54 finite-volume and finite-difference discretizations.. Each discretization will divide the domain into a mesh of cells, and the evolved variables will be located at the cell-centers. Both will be described along a single spatial direction, but will generalize to all directions. In the following, the notation Ui will represent cell-centered quantities in the i-th cell along an axis in the mesh, and Ui ± of the i-th cell. 1/2 will represent the upper (+) and lower (-) face-centered quantities 3.2.2.1 Eigenstructure The eigenstructure of the spatial advection operator describes the characteristic trajectories and speeds of the solution variables in space and time. These characteristics are necessary for determining the upwind direction of the flow in order to maintain numerical stability when discretizing this operator. To examine these characteristics, the spatial advection operator is first written in the form ∂jFj(U) = ∂Fj ∂U ∂jU = Aj∂jU, (3.110) where Aj is the Jacobian matrix of Fj. Using Eqns. (3.103)–(3.104) in Eq. (3.110), the Jacobian takes the form βj − ∂P j i ∂E Aj =  α    αγjk ∂P j i ∂Fk − α βjγk i ,     (3.111) where i and k represent the row and column indices, respectively; j is fixed for each direction. The characteristic speeds are then simply the eigenvalues of Aj obtained from the solution 55 of det Aj (cid:16) − λI = 0, (cid:17) (3.112) where λ is an eigenvalue of Aj, and I is the identity matrix. However, in this most general form, the derivatives of the pressure tensor with respect to the energy and momentum densities are complicated by the presence of the closure factor ξ. An equivalent approach to finding the characteristic speeds is to solve Eq. (3.112) separately for the optically thin and thick limits and interpolate the characteristic speeds in the same way as the pressure tensor (Shibata et al., 2011). For the optically thin limit, taking the derivatives of the pressure tensor in Eq. (3.55) with respect to the energy and moment densities yields ∂ ∂E ∂ ∂Fk P j i P j i (cid:104) (cid:104) (cid:105) (cid:105) thin thin = ˆf j ˆfi, = E F γjk − (cid:104)(cid:16) 2 ˆf j ˆf k ˆfi + γk i ˆf j . (cid:17) (cid:105) (3.113) (3.114) Using these derivatives in the Eq. (3.111) leads to the optically thin limiting forms of the characteristic speeds in the j-th direction λ±thin = λ0 thin = α ˆf j, βj ± βj + α ˆf j, E F − − (3.115) (3.116) where the characteristic speed λ0 thin is doubly degenerate. Similarly for the optically thick limit, taking the derivatives of the pressure tensor in Eq. (3.67) with respect to the energy 56 and moment densities yields ∂ ∂E ∂ ∂Fk P j i (cid:104) P j i (cid:104) thick (cid:105) thick (cid:105) = = 1 2W 2 + 1 2W 2 2W 2 + 1 2W 2 γj 1 − (cid:104)(cid:16) γj vjvi − i (cid:16) (cid:17) (cid:17) 4W 2vjvi , i − (cid:105) ivj. vk + γjkvi + γk (3.117) (3.118) Using these derivatives in the Eq. (3.111) leads to the optically thick limiting forms of the characteristic speeds in the j-th direction 2W 2pj βj + ± α2 (cid:113) 2W 2 + 1 2W 2 + 1 (cid:1) (cid:0) γjj − 2W 2pjpj , (3.119) βj + pj, (3.120) λ±thick = λ0 thick = − − where2 pj = αγjkuk/W = αvj, and once again the characteristic speed λ0 thick is doubly degenerate. The closure interpolated characteristic speeds are then given as ,0 = λ± 3χ(ξ) 2 1 − ,0 λ± thin + 3[1 χ(ξ)] − 2 ,0 thick. λ± (3.121) 3.2.2.2 Finite-Volume Discretization For the finite-volume discretization, the cell-centered Ui are treated as the volume-averages over the i-th cell. The spatial fluxes of the evolved variables in and out of each cell are approximated at the interfaces between the cells. The values of the evolved variables needed in evaluating Eq. (3.104) are not known at the cell-interfaces, so they must be reconstructed 2Most works citing the optically thick characteristic speeds of Eq. (6.35) in Shibata et al. (2011) incorrectly αvj /W . However, in section 6.2 of Shibata et al. (2011), V j is defined as the assume that pj = αV j /W vj leads spatially projected co-moving frame four-velocity V j = γjkuk = W vj . Incorrectly assuming V j to increasingly wrong characteristic speeds at relativistic velocities. For example, in a flat spacetime and vj leads to characteristic speeds that approach zero, the limit of v whereas the correct definition V j W vj leads to the expected characteristic speeds that approach unity. 1, using the incorrect definition V j → ≡ ≡ ≡ ≡ 57 from their cell-centered values. In each cell, the values at the upper (+) and lower (-) interface are reconstructed using a total-variation diminishing piecewise linear interpolation over a stencil including the adjacent cells (Kurganov & Tadmor, 2002; Toro, 2009) U±i = Ui ± 1 2 ϕ(r, θ)∆Ui+1, where ϕ(r, θ) is the generalized minmod slope limiter ϕ(r, θ) = max 0, min rθ, (cid:20) (cid:18) r + 1 2 , θ , (cid:19)(cid:21) 1 θ ≤ ≤ 2, and the slopes and their ratio are defined as r = ∆Ui ∆Ui+1 , ∆Ui = Ui − Ui − 1. (3.122) (3.123) (3.124) Use of a generalized minmod limiter provides a means of varying the amount of dissipation in the reconstructed slopes via the parameter θ. The limiter is most dissipative when θ = 1, and least dissipative when θ = 2. This flexibility allows more dissipation to be added when necessary, e.g., to smooth out potential overshoots near shocks and rarefactions in the fluid. In practice, the neutrino moments E and Fi/E are reconstructed instead of the evolved densitized moments ˜E and ˜Fi. To minimize errors in reconstruction, the densitization factor √γ is removed since linear interpolation may not always be suitable for spacetime quantities. For instance, with a simple spherically symmetric Minkowski spacetime, the factor √γ = r2 will not be correctly reconstructed when the reconstruction stencil overlaps the reflective boundary at the origin. Reconstructing the ratio Fi/E prevents the superluminal momentum 58 densities that can occur when reconstructing Fi directly (Foucart et al., 2015; O’Connor, 2015). Additionally, the fluid velocity vi is reconstructed in a similar manner, but the spacetime quantities α, βi, and γij, which are smooth in space, are reconstructed with a fourth-order Lagrange interpolating polynomial. All derived quantities, including the closure factor ξ, pressure tensor P ij, characteristic speeds, inverse spatial metric γij, its determinant γ, and the fluid’s Lorentz factor W , are calculated in terms of the reconstructed interface values. There are now two reconstructed states for each interface, the upper face from the cell to the left and the lower face from the cell to the right. In general, these two states are not necessarily the same, and form a local Riemann problem that must be solved to resolve the discontinuity. First, the left (L) and right (R) states at the i + 1/2 interface are chosen as UL i+1/2 = U+ i , UR i+1/2 = U−i+1, and then used to compute the spatial fluxes via Eq. (3.104) as L i+1/2 Fj (cid:104) (cid:105) = Fj UL i+1/2 (cid:16) R i+1/2 Fj (cid:104) (cid:105) = Fj UR i+1/2 . (cid:16) (cid:17) , (cid:17) (3.125) (3.126) With these states and their fluxes, the local Riemann problem is solved by using the Harten, Lax, van Leer (HLL) approximate Riemann solver (LeVeque, 2002; Toro, 2009), giving the flux across the interface Fj (cid:104) i+1/2 (cid:105) = s+[Fj]L i+1/2 − s−[Fj]R i+1/2 + εs+s− s+ s− − (cid:16) UR i+1/2 − UL i+1/2 , (cid:17) (3.127) where the fastest characteristic speeds in the left-to-right (+) and right-to-left (-) directions 59 are s+ = max ,0 λ± L , ,0 λ± R (cid:18)(cid:110) s− = min ,0 λ± (cid:18)(cid:110) (cid:111) L (cid:110) λ± ,0 , (cid:111) R (cid:111) (cid:110) (cid:111) (cid:19) , (cid:19) (3.128) and the factor ε corrects for the optically thick limit. In this limit, the neutrinos behave diffusively and the evolution equations are no longer hyperbolic. The HLL Riemann solver fails to produce the correct form of the flux when there are large gradients between the left and right states. The correction method utilized here follows similar approaches in Skinner et al. (2019); Radice et al. (2022); Cheong et al. (2023), and decreases the contribution from the final term in Eq. (3.127) as the optical depth increases. For this purpose, the correction factor is defined as ε = min 1 τ j i+1/2 ,   1,   (3.129) where τ j i+1/2 is the geometric average of the optical depths across each of the adjacent cells in the j-th direction τ j i+1/2 = i τ j τ j i+1. (cid:113) (3.130) Each cell’s optical depth is approximated by i = [κabs + κiso]i dxj τ j i , (3.131) where dxj i is the proper distance across the i-th cell in the j-th direction. Finally, the second-order approximation of the divergence of the spatial flux can be found 60 from the interface fluxes as ∂jFj(U) = (cid:2) i (cid:105) (cid:104) Fj i+1/2 − ∆xj (cid:2) (cid:3) Fj (cid:3) i 1/2 i − , (cid:2) (cid:3) (3.132) where ∆xj (cid:2) i is the width of the i-th cell in the j-th direction. (cid:3) 3.2.2.3 Finite-Difference Discretization The finite-difference discretization is based on the one presented in Radice et al. (2022), and the key elements are described below. This discretization assumes that the evolved variables Ui are point-like values at the cell-centers. Again, the spatial advection operator is evaluated across each cell by Eq. (3.132), but in contrast with the finite-volume discretization, the fluxes at the cell interfaces are approximated directly from the cell-centered values. While this allows for a more computationally-efficient implementation of the flux calculations, this discretization is more dissipative than both the previous finite-volume discretization and the high-order finite-difference discretization used for hydrodynamics that will be presented later in chapter 4. Since this discretization only makes use of the cell-centered states Ui, Eq. (3.104) is evaluated for each cell = Fj(Ui), Fj (cid:104) i (cid:105) (3.133) along with its characteristic speeds via Eq. (3.121). These cell-centered fluxes are then used to make high-order and low-order approximations of the flux at the interface of two adjacent 61 cells. A Lax-Friedrichs approximation is used for the low-order (LO) flux Fj (cid:104) LO i+1/2 (cid:105) = 1 2 Fj i (cid:105) (cid:18)(cid:104) + Fj (cid:104) (cid:105) i+1 − (cid:19) 1 2 λmax Ui+1 − (cid:18) Ui , (cid:19) (3.134) where λmax is the fastest characteristic speed in the adjacent cells λmax = max ,0 λ± (cid:18)(cid:110)(cid:12) (cid:12) (cid:12) ,0 λ± , i (cid:111) (cid:12) (cid:12) (cid:12) (cid:110)(cid:12) (cid:12) (cid:12) . (cid:19) i+1 (cid:111) (cid:12) (cid:12) (cid:12) A second-order approximation is used for the high-order (HO) flux Fj (cid:104) HO i+1/2 (cid:105) = 1 2 Fj i (cid:105) (cid:18)(cid:104) + Fj (cid:104) (cid:105) . i+1 (cid:19) (3.135) (3.136) Alternatively, higher-order approximations can be used, such as the WENO scheme discussed in chapter 4 for the hydrodynamics solver, but will incur an increased computational cost. Finally, the flux at the interface is approximated by a variation of a flux-limiter approach Fj (cid:104) i+1/2 (cid:105) = Fj (cid:104) HO i+1/2 − (cid:105) ε(1 ϕ) − HO i+1/2 − Fj (cid:18)(cid:104) (cid:105) Fj (cid:104) LO i+1/2 (cid:105) (cid:19) , (3.137) where similarly to the finite-volume discretization, ε is the corrective factor for the optically thick limit, and ϕ is the minmod limited slope from the states in the surrounding cells. These interface fluxes are then used to evaluate the spatial advection operator via Eq. (3.132). 3.2.3 Frequency Advection Velocity- and gravitational-dependent redshifting effects lead to a change in the number density, and consequently the energy density, of neutrinos with a frequency ν, as measured 62 by a co-moving observer. In Eq. (3.102), these changes in frequency are described by the term ∂νR(U), which characterizes advection along the ν-axis (the remaining momentum degree-of-freedom after performing the moment expansion). Advection along this ν-axis effectively couples the evolution equations for each frequency of neutrinos being evolved. This section will present a new method for discretizing this operator that aims to be more computationally- and memory-efficient to implement. Since ∂νR(U) accounts for the flux of neutrinos between different frequencies, it must vanish when integrating the evolution equations over all neutrino frequencies, i.e., ∞ dν ∂νR(U) = 0, 0 (cid:90) (3.138) in order to conserve the neutrino number and energy densities (M¨uller et al., 2010). For Eq. (3.138) to hold, R(U) must vanish at the endpoints ν = 0, . The discretization of the ∞ frequency-advection operator will need to enforce these boundary conditions on both R(U) and its derivative. A common approach to discretizing the frequency-advection operator uses a flux conser- vative finite-volume method that breaks up the ν-axis into frequency-bins. The moment- expansion and its projection are now represented as the bin-integrated values ˜M Ak (¯νi) = ¯νi+1/2 ¯νi (cid:90) − 1/2 dν ˜M Ak (ν) , (3.139) where ¯νi and ¯νi+1/2 are the bin-center and bin-interface values, respectively, of the frequency in the i-th bin. Simply using the bin-integrated values directly in Eq. (3.105) will not guarantee that Eq. (3.138) holds, so the monochromatic values at the bin-interfaces must 63 be reconstructed while accounting for the boundary conditions. These interface values are typically reconstructed from both directions, and then a weighted contribution from both states is used to approximate the flux across the bin-interface. For examples of this type of flux-conservative discretization, please refer to M¨uller et al. (2010); O’Connor (2015); Cheong et al. (2023). While these frequency-bin discretizations can be constructed to guarantee number and energy conservation, there are drawbacks to their use. The frequency-bins are usually log- arithmically spaced, and typical approximations of the bin-center values made from the bin-totals such as ˜E(νi) = ˜E(¯νi)/∆¯νi may not accurately reflect the actual bin-centered monochromatic values in larger bins. Additionally, since an infinitely-wide bin at the upper boundary is not possible, an arbitrary upper boundary where the moments are expected to be negligible must be chosen; this can be problematic if the contributions near this bound- ary become non-negligible during evolution. Finally, these discretizations commonly rely on small stencils of bins when approximating the ν-derivatives, and can require a large number of bins to achieve sufficient resolution over a desired range of frequencies. Since there are four equations to solve for every neutrino frequency and species, this quickly leads to soaring computational costs as the number of evolved neutrino frequencies is increased. Instead, this implementation will make use of a pseudospectral discretization of the ν-axis. In a pseudospectral discretization, evolved quantities are projected onto a set of orthogo- nal polynomial basis functions to build interpolants of these quantities and their derivatives in their original coordinate basis (Boyd, 2013). Spectral and pseudospectral methods are commonly used in numerical relativity, as they can achieve an accuracy comparable to finite- difference and finite-volume methods while using a much smaller set of discretization points (Baumgarte & Shapiro, 2010). Applying a pseudospectral discretization to the frequency 64 advection operator allows the monochromatic projected moments to be evolved directly, and quadrature rules associated with a chosen polynomial basis will provide more accurate ap- proximations to the frequency-integrated quantities than those made with a simple Riemann sum in a frequency-bin discretization. 3.2.3.1 Basis Polynomials Choosing an appropriate set of basis polynomials is absolutely critical. Commonly used Chebyshev polynomials prove useful for almost all non-periodic problems (Boyd, 2013), but an ideal set of basis polynomials will automatically meet the boundary conditions and have a domain that easily maps to the ν-axis. Since neutrinos are fermions, one such option are the set of polynomials that are orthogonal with respect to the Fermi-Dirac distribution. This section will describe a set of Fermi-Dirac weighted orthogonal polynomials and their associ- ated quadrature rule, based on a method for calculating moments of an electron distribution function presented in Oettinger et al. (2013). Let n(x) be the set of polynomials that are orthogonal with respect to the inner product F m n |F ⟩ ⟨F = ∞ 0 (cid:90) dx fk(x) F m(x) F n(x) = Dmδmn, (3.140) where Dm is a normalization constant, δmn is the Kronecker delta, and the weight fk(x) is a generalized Fermi-Dirac distribution fk(x) = xk ex + 1 . (3.141) The polynomials F n(x) are constructed via the Gram-Schmidt process (Roman, 2007) ap- 65 plied to the set of polynomials n(x) = xn X n(x) = n(x) X − F n 1 − (cid:88)m=0 n m m |F |F ⟩ m ⟩ ⟨X ⟨F m(x). F (3.142) These basis polynomials are then used to form an N -point quadrature rule with nodes xi and weights wi (Press et al., 2007). The N nodes and weights are FN (xi) = 0 dx ∞ 1 F ′N (xi) 0 (cid:90) fk(x) x FN (x) xi − wi = , i < N. 0 ≤ (3.143) For practical purposes, the basis polynomials for up to N = 6, along with their nodes and weights, are pre-computed numerically using Mathematica (Wolfram Research, Inc., 2023). This quadrature rule can approximate the integral of a function g(x) = fk(x)h(x) as ∞ dx g(x) = ∞ 0 (cid:90) 0 (cid:90) dx fk(x)h(x) N 1 − (cid:88)n=0 ≈ wnh(xn) = N 1 − (cid:88)n=0 wn fk(xn) g(xn), (3.144) where a factor of fk(xn) must be removed if g(x) is used directly in the summation. 3.2.3.2 Derivatives and Integrals of Frequency-Dependent Quantities The basis polynomials are used to build an interpolating polynomial along the ν-axis. In order to make use of the quadrature rules in the previous section, the frequencies ν must be mapped to the quadrature nodes xi, i.e., νi = ν(xi). In the simple case of a equilibrium distribution, the map takes the form ν(x) = T x, (3.145) 66 where T is the equilibrium temperature; this is the direct result of making the substitution ν/T → x to arrive at Eq. (3.141). Next, frequency-dependent quantities must be projected onto the polynomial basis. An arbitrary frequency-dependent M(ν) is projected on to the basis polynomials via the inner product (of the same form as Eq. (3.140)) mi = ∞ 1 Di (cid:90) 0 dx fk(x)M(ν(x))Fi(x) = 1 Di N 1 − (cid:88)m=0 wnM(νn)Fi(xn), (3.146) where the summation directly applies the quadrature rule associated with the polynomial basis functions, and the normalization factor Di is accounted for separately since it is not included in the definition of the polynomials. With these coefficients, the interpolating polynomial for a frequency-dependent quantity takes the form M(ν(x)) = N 1 − (cid:88)i=0 mi[ Fi(x)fk(x)], from which its derivative immediately follows as ∂νM(ν(x)) = 1 ν′(x) N 1 − (cid:88)i=0 mi[ Fi(x)fk(x)]′, (3.147) (3.148) where the primed quantities are derivatives with respect to x. The x-dependence (and consequently ν-dependence) are now completely contained in the basis polynomial and weight functions and their derivatives. When working strictly with frequency-dependent quantities located at the N quadrature nodes, all the of x-dependent quantities can be pre-computed, and calculating Eqns. (3.146)– (3.148) for all N points reduces to matrix-vector multiplications. For this case, the frequency- 67 integrated quantities reduce to the vector dot-product M = 0 (cid:90) ∞ dν M(ν) = ∞ 0 (cid:90) dx ν′(x)M(ν) = N 1 − (cid:88)i=0 wi fk(xi) ν′(xi)M(νi). (3.149) In application to the frequency advection operator, R(U) is computed first for each neu- trino frequency νi. Next, these values are projected on to the basis functions via Eq. (3.146). Finally, Eq. (3.148) is used to evaluate the full operator ∂νR(U) for all frequencies νi. When frequency-integrated quantities are required, e.g., for the frequency-integrated full collision source term in Eq. (3.80), or for outputting the frequency-integrated projected moments, Eq. (3.149) is used directly. This will also prove useful for additional neutrino-matter in- teractions that require the evaluation of frequency-integrals, such as inelastic scattering of neutrinos off of electrons. 3.2.4 Geometric Sources The geometric source terms G(U) are evaluated directly in terms of the cell-centered neutrino and spacetime variables. Computations of the spatial derivatives of the spacetime quantities all use a centered fourth-order finite-difference operator ∂g ∂xj ≈ 1 12∆xj [gi − 2 − 8gi 1 + 8gi+1 − − gi+2], (3.150) where g is replaced with, respectively, the lapse α, the shift components βi, and the spatial metric components γij. This operator is applied separately along each direction j. The derivatives of the spacetime quantities, fluid velocity, and Lorentz factor present in the fre- quency advection terms are also computed using Eq. (3.150). While the spatial accuracy for 68 both the finite-volume and finite-difference discretizations is only second-order, this fourth- order approximation for the derivatives of the spacetime quantities mirrors the difference operators used in the spacetime solvers described later in chapter 5. 3.2.5 Time Integration The disparate timescales associated with each of the operators in Eq. (3.102) complicate the time integration of the evolution equations. The advective timescale, which is at worst the light-crossing time of the smallest cell, can be used to stably evolve most terms in Eq. (3.102) with explicit time integration methods. However, the timescales of the neutrino-matter in- teractions are 1/κea,iso O (Burrows et al., 2006), which quickly become orders of magnitude smaller than the advective timescale at high optical depths. These timescales cannot be sta- (cid:0) (cid:1) bly evolved with explicit methods for any practical size of the time-step. While fully-implicit time integration methods can be used to stably evolve Eq. (3.102) for a more-practical choice of time-step, the computational and memory costs rapidly become prohibitive for large num- bers of neutrino species and frequencies since the spatial- and frequency-advection operators are non-local along their respective axes. Instead, Eq. (3.102) will be integrated using a hybrid implicit-explicit (IMEX) method in a method-of-lines (MoL) discretization (see chapter 6 for more details about the MoL discretization and the IMEX time-integrator, and their implementation in Flash-X). When using the IMEX method for time-integration, an explicit integration method is applied to the advective and geometric sources, and is coupled to an implicit integration method used for updating the neutrino-matter interaction sources. Extending the notation in Eq. (3.102) as Un to now include a superscript n referring to the state at the n-th time-step, the evolution 69 equation is written in the form ∂tUn → n+1 = F E Un + F I Un+1 F E Un (cid:16) (cid:17) = − ∂jFj Un (cid:16) (cid:17) − ∂νR Un (cid:16) + G (cid:17) Un (cid:16) , (cid:16) (cid:17) (cid:16) (cid:17) F I (cid:17) (cid:16) Un+1 = S Un+1 , (cid:17) (cid:16) (cid:17) (3.151) for advancing the evolved variables from Un to Un+1, where F E and F I are used to update the evolved variables explicitly and implicitly, respectively. The interactions sources are updated implicitly during each stage of time integration. Since the included interactions described earlier in the chapter do not couple the neutrinos between frequencies, the implicit-update equation takes a block-diagonal matrix form, where there is one 4 × 4 block for each neutrino species and frequency. This greatly simplifies the update procedure, allowing each block in the equation to be solved separately. As these terms are highly non-linear due to the closure interpolation, they cannot be directly inverted, so Newton-Raphson iterations are used to find the root of the function G Un+1 = Un+1 (cid:16) (cid:17) − (cid:104) Un + ∆tF E Un (cid:16) (cid:17)(cid:105) − ∆tF I Un+1 = 0. (3.152) (cid:16) (cid:17) While the preceding equation is for the full time-step, this procedure takes the same form for finding the intermediate states during every integration stage. The incoming state (the terms in the brackets) is used as the initial guess. Alternatively, an initial guess can be made by transforming E and Fi to the co-moving frame, explicitly evolving J and Hi, and transforming their solution back to the Eulerian frame; this provides an approximation for J and Hi accurate to O (v/c), but not necessarily for E and Fi. See Radice et al. (2022); Cheong et al. (2023) for examples of this type of initial guess. The Newton-Raphson iterations then 70 take the form (Press et al., 2007) Uk+1 = Uk Uk 1 − (cid:17)(cid:105) Uk , (cid:17) G (cid:16) − G′ (cid:104) (cid:16) where G′ is the Jacobian of Eq. (3.152) G′(U) = I − ∆t ∂F I ∂U , (3.153) (3.154) and I is the identity matrix. See appendix F for the full form of the derivatives of the interaction source terms in Eq. (3.154). A common approach to simplifying the implicit update procedure is linearizing the in- teraction source terms, allowing for a direct inversion of Eq. (3.152). This can be accom- plished by assuming the direction of the momentum remains constant, i.e., ˆf i = const. or vkF k = const., or that the closure does not change as a result of the implicit update, i.e., ξ = const.. See Foucart et al. (2015); Weih et al. (2020) for examples of these linearizations. However, these types of approximations can be problematic for maintaining energy and mo- mentum conservation (Radice et al., 2022). Instead, following the methods in Radice et al. (2022); Cheong et al. (2023), the closure is computed for every iteration and all non-linear terms in the interaction sources are retained. 71 Chapter 4 General Relativistic Hydrodynamics The general relativistic neutrino radiation transport solver presented in chapter 3 is of limited use on its own when applied to problems in vacuum or with fixed-background fluids. Coupling the evolution of the neutrinos with the fluid requires a compatible hydrodynamics formulation in order to enforce energy and momentum conservation and maintain numerical consistency and stability. In the dynamic curved spacetimes present during neutron star mergers and near the compact objects formed during core-collapse supernovae, the effects of general relativity on the evolution of the fluid and neutrinos cannot be ignored. This chapter will present the formulation of and the numerical methods used for a general relativistic hydrodynamics solver, while its implementation will be presented later in chapter 6. 4.1 Mathematical Formalism For the method presented here, only an ideal fluid will be considered, with the stress-energy tensor defined in the fluid’s restframe T ab = ρhuaub + pgab, (4.1) where ua is the four-velocity of a co-moving observer, gab is the inverse of the full spacetime metric, ρ and p are the fluid density and pressure, respectively, and the specific enthalpy is h = 1 + ϵ + p ρ = e + p ρ , (4.2) 72 with a total energy density e = ρ(1 + ϵ) including contributions from the fluid’s rest-mass and the internal energy ϵ. Similarly to the neutrino radiation transport formulation in chapter 3, it will be necessary to define the stress-energy tensor in the Eulerian frame of the 3+1 split spacetime. In this frame, the stress-energy tensor takes the form T ab = nanb + anb + bna + ab, S S S E (4.3) where na is the four-velocity of the Eulerian observer, or equivalently the normal vector to each spacelike hypersurface in the spacetime decomposition. In analogy to the neutrino moment-expansion projected moments, the Eulerian projections of the fluid stress-energy tensor are found as = nanbT ab = ρhW 2 − anbT ab = ρhW 2vi γi E i = p S − ij = γi S aγj bT ab = ρhW 2vivj + pγij, (4.4) (4.5) (4.6) where vi is the fluid velocity with Lorentz factor W = 1/ vivi. These projections result 1 − from using the Eulerian decomposition of the four-velocity in Eq. (3.36). (cid:112) Energy and momentum conservation are guaranteed when the total stress-energy tensor of the fluid and neutrinos is divergence free, T ab + ∇b (cid:34) σ (cid:88) M ab (σ) (cid:35) = 0, (4.7) where ∇b is the covariant derivative operator, and the summation is over the frequency- 73 integrated neutrino stress-energy tensor of each neutrino species. In comparison with the frequency-integrated second-rank moment expansion equations in Eq. (3.13), it follows that the fluid energy and momentum densities must obey ∇bT ab = Sa tot., − (4.8) where Sa tot. is the full sum-over-species integrated-over-frequencies neutrino-matter inter- action source term defined in Eq. (3.80). Mass conservation is enforced by requiring the rest-mass density along the trajectory of the co-moving observer to remain divergence-free ∇a(ρua) = 0. (4.9) This equation is commonly referred to the mass-current continuity equation. The evolution equations for the energy and momentum densities result from the timelike and spacelike projections of Eq. (4.8) and take the exact same form as the neutrino moment evolution equations ∂ ˜ E ∂t ∂ ˜ Si ∂t + + ∂ ∂xj ∂ ∂xj (cid:16) (cid:16) j α ˜ S − j α ˜ i − S βj ˜ E (cid:17) βj ˜ Si i ∂ ln α ijKij − ∂xi + na ˜Sa ˜ ˜ S S ˜ ∂βj jk ∂γjk Sj ˜ ∂xi − α S ∂xi − ˜ E 1 2 tot. (cid:21) ∂ ln α ∂xi − = α (cid:20) = α (cid:17) (cid:34) (4.10) (4.11) γia ˜Sa tot. . (cid:35) The evolution equation for the rest-mass density follows directly from using the Eulerian decomposition of the co-moving four-velocity, Eq. (3.36), in Eq. (4.9) to find ∂ ˜ D ∂t + ∂ ∂xj αvj βj − ˜ D (cid:104) (cid:16) (cid:17)(cid:105) = 0, (4.12) 74 where D = ρW is the rest-mass density measured in the Eulerian frame. In the preceding evo- lution equations, all tilde-quantities include the densitization factor √γ, where γ = det γij. A common modification made to the energy density evolution equation to facilitate numer- ical implementations is to separate the contribution from the rest-mass energy by defining the new variable τ = E − D (Rezzolla & Zanotti, 2013). Substituting this new variable into Eq. (4.10) and using Eq. (4.12) to eliminate the terms proportional to gives the modified D energy density evolution equation ∂ ˜τ ∂t + ∂ ∂xj α (cid:104) (cid:16) j ˜ S vj ˜ D − βj ˜τ (cid:105) − (cid:17) = α (cid:20) ijKij − ˜ S i ∂ ln α ∂xi + na ˜Sa ˜ S tot. . (cid:21) (4.13) This flux-conservative form of the evolution equations in Eqns. (4.11)–(4.13) without the neutrino-matter interaction sources terms is commonly referred to as the Valencia formula- tion and was first proposed in Banyuls et al. (1997). 4.2 Numerical Methods This section will describe the high-order finite-difference discretization used to solve the fluid evolution equations. A similar notation to the one used in chapter 3 will be used to separate Eqns. (4.11)–(4.13) into terms of operators acting on the evolved variables. Using a different font typeface to distinguish these vectors and operators from the ones used in chapter 3, the evolution equations are written in the form ∂tU + ∂jFj(U) = G(U) + S(U), (4.14) 75 where the vector of evolved conserved variables is U = ˜ D  ˜ Sj    ˜τ     ,       the flux vector in the spatial advection operator for the j-th direction is Fj(U) =        α the geometric source vector is βj − (cid:1) βj ˜ Si αvj ˜ D (cid:0) j α ˜ i − S ˜ vj D − ˜ j S − (cid:17) (cid:16)  ,       βj ˜τ 0 G(U) = α        1 2 ˜ jk∂iγjk − α− S ˜ ijKij − S 1 ˜ Sj∂iβj − ˜ i∂i ln α S ˜ ∂i ln α E ,        and the neutrino-matter interaction source vector is 0 S(U) = α γia ˜Sa tot. − na ˜Sa tot.         .       (4.15) (4.16) (4.17) (4.18) The source terms on the right-hand side of Eq. (4.14) are treated similarly to those in the neutrino moment evolution equations, so they will only briefly be described here. The geometric sources take the exact same form as those in the neutrino moment evolution equa- 76 tions, and are calculated in the same way as described in chapter 3. The neutrino-matter interaction sources will be handled in a simplified manner: the opacities characterizing the interactions will be held fixed when implicitly updating the evolved neutrino variables, and then will subsequently be used to explicitly update the fluid variables. This method is commonly used in radiation transport solvers and works well so long as the fluid does not rapidly change over the course of a single time-step; see Foucart et al. (2015); O’Connor (2015); Radice et al. (2022); Cheong et al. (2023) for examples of this method. Implicitly updating the fluid variables alongside the neutrino variables would fully-couple all neutrino frequencies, vastly increasing the computational cost by requiring an iterative solution of the much-larger 5 + 4 Nfreq × × Nspecies 5 + 4 Nfreq × × × Nspecies matrix equation (which is no longer strictly block-diagonal) for the full fluid plus neutrino system of evolution equa- (cid:1) (cid:0) (cid:1) (cid:0) tions. The remainder of this section will be dedicated to describing the eigenstructure and the discretization of the spatial advection operator, as well as a method used to recover the primitive variables, such as the density, pressure, and velocity. Similarly to the presenta- tion of the discretization of the neutrino moment evolution equations, the following will be presented for a single spatial direction, but will generalize to all spatial directions. The quantities Ui will refer to cell-centered values in the i-th cell along the chosen direction, and the quantities Ui ± 1/2 will refer to the upper (+) and lower (-) cell-interface values. 4.2.1 Eigenstructure The eigenstructure of the spatial advection operator is used to determine its characteristic trajectories and speeds. The speeds are immediately useful for determining the maximum stable time-step size, although the neutrino characteristic speeds typically require a smaller 77 time-step size. The characteristic trajectories provide a decoupled form of the advection operator that can robustly capture shocks that form in the fluid. To examine this eigen- structure, the spatial advection operator in the i-th direction will first be written as ∂iF(U) = ∂Fi ∂U ∂iU = Ai∂iU, (4.19) where the flux operator Ai is the Jacobian of the spatial flux vector Fi with each row corre- sponding to the elements of Fi and each column the derivative with respect to elements of U. The flux operator can be diagonalized by its eigendecomposition in the form Ai = R− 1ΛR, (4.20) where Λ is a diagonal matrix of the eigenvalues of Ai, and R is the matrix of right-eigenvectors, with each column corresponding representing the eigenvector associated with the same col- umn in Λ. The characteristic speeds for the evolution equations are simply the eigenvalues of Ai. For the Valencia formulation, the unique eigenvalues associated with the flux in the i-th direction are λ ± which characterizes acoustic waves, and the triply-degenerate λ0 which characterizes matter waves (Banyuls et al., 1997) = λ ± − βi + c2 s pi 1 − cs ± (cid:0) (cid:1) v2 − 1 (cid:113)(cid:0) 1 (cid:1)(cid:2) α2 1 − v2c2 (cid:0) s − βi + pi, λ0 = − v2c2 s γii 1 − − c2 s pipi (cid:1) (cid:0) (cid:1) , (cid:3) (4.21) (4.22) where pi = αvi, and cs is the relativistic sound speed of the fluid defined in terms of the the 78 thermodynamic derivatives of the pressure with respect to the density and internal energy, while holding the opposite quantities constant, hc2 s = ∂p ∂ρ (cid:18) (cid:19)ϵ + p ρ2 ∂p ∂ϵ . (cid:19)ρ (cid:18) In normal ordering, the eigenvalue matrix is then Λ = diag(λ − , λ0, λ0, λ0, λ+). (4.23) (4.24) The analytic forms of the eigenvectors for the Valencia formulation are also known, and will prove useful in projecting the evolved variables and their fluxes on to their characteristic trajectories. The right-eigenvectors for this system are presented in Ibanez et al. (1999); Rezzolla & Zanotti (2013) and are summarized here for reference. For the i-th direction, the components of the eigenvectors r( ) = ± ) ( r ± 0 ) ( , r ± 1 ( , r ± 2 ) ) ( , r ± 3 ( , r ± 4 ) (cid:104) r ( ) 0 = 1, ± r ) ( i = hW ± , i V ± r ) ( j = hW vj, ± r ) ( k = hW vk, ± r ) ( 4 = hW ± i ± − A 1, T (cid:105) associated with λ ± are (4.25) with i V ± = vi γii Λi ± viΛi ± − − , i A ± = γii γii vivi viΛi ± − − , λ ± = + βi α . Λi ± (4.26) 79 The components of the eigenvectors r(0,n) = (0,n) r 0 (0,n) , r 1 (0,n) , r 2 (0,n) , r 3 (0,n) , r 4 (cid:104) associated T (cid:105) with λ0 are = K hW , = vi, = vj, = vk, = 1 , K hW − (0,1) r 0 (0,1) r i (0,1) r j (0,1) r k (0,1) r 4 where (0,2) r 0 (0,2) r i r (0,2) j (0,2) r k r (0,2) 4 = W vj, = h γij + 2W 2vivj , (cid:16) = h (cid:17) γjj + 2W 2vjvj , (cid:16) = h (cid:17) γkj + 2W 2vkvj , (cid:16) = W vj(2hW (cid:17) 1), − (0,3) r 0 r (0,3) i (0,3) r j r (0,3) k (0,3) r 4 = W vk, = h γik + 2W 2vivk , (cid:16) = h (cid:17) γjk + 2W 2vjvk , (cid:16) = h (cid:17) γkk + 2W 2vkvk , (cid:16) = W vk(2hW (cid:17) 1), − = K (∂p/∂ϵ )ρ (∂p/∂ϵ )ρ − ρc2 s . (4.27) (4.28) The explicit component notation for the five components of each eigenvector allows for a straightforward specialization in each spatial direction, where the i, j, k components are easily permuted for different directions. For each direction i = 1, 2, 3, the corresponding values of i, j, k for the components and their ordering take on the cyclic permutations of i, j, k = 1, 2, 3. With these, the right-eigenvector matrix corresponding to the eigenvalue matrix Λ in Eq. (4.24) takes the form R = r( − ), r(0,1), r(0,2), r(0,3), r(+) . (cid:104) (cid:105) (4.29) The inverse of the right-eigenvector matrix, also referred to as the left-eigenvector matrix, has rows that correspond to the left-eigenvector for the eigenvalue in the same row in Λ. These also have known analytic forms for the Valencia formulation (Ibanez et al., 1999; Rezzolla & 80 Zanotti, 2013), and are summarized here for reference. Using a similar component notation, the left-eigenvectors associated with λ in the i-th direction are ± ) ( 0 = hW ζ l ± ) ( + l ± 4 , i V ∓ ( ) l i = ± ( ) l j = ± ( ) l k = ± ( ) l 4 = ± (cid:16) (cid:16) (cid:16) (cid:16) 1 1 1 i − KA ∓ i − KA ∓ i − KA ∓ (cid:17) (cid:17) Γii + Γij + (cid:16) Γik + 1 W 2ζvi (cid:17)(cid:16) 1 (cid:17)(cid:16) 1 W 2ζvj W 2ζvk 2 K − (cid:16) 2 K − 2 K − 1 K − (cid:17) W 2ζ (cid:16) Γii − (cid:17)(cid:16) i ∓ − V γvi (cid:17)(cid:104)(cid:16) (cid:17) − K (cid:105) , i V ∓ Γiivi (cid:17) Γijvi − − (cid:17) Γikvi i , V ∓ − W 2ζ (cid:17) i , V ∓ , i V ∓ (4.30) l( ± ) = h2 ∆ ∓ (cid:104) ) ( l ± 0 , l ) ( ± 1 , l ) ( ± 2 , l ) ( ± 3 , l ) ( ± 4 , (cid:105) (4.31) and the left-eigenvectors associated with the triply-degenerate λ0 in the i-th direction are (0,1) l 0 (0,1) l i (0,1) l j (0,1) l k W, = h − = W vi, = W vj, = W vk, (0,1) l 4 = W, − (0,2) 0 l (0,2) l i (0,2) j l (0,2) l k (0,2) 4 l γkk vj , = γjk vk − γkk vj − = (cid:17) iγkk + γik vk vi, γjk vk = (cid:16) B (0,3) l 0 (0,3) i l vi, = γkj vj − γjj vk − = γjj vk , γkj vj vi, (cid:17) (cid:16) (0,3) l j = i γij vk vi, − −B iγjj + γij vj vi, i = − −B (0,2) = l 0 , γik vj vi, (0,3) l k (0,3) 4 l = B (0,3) = l 0 , 1 l(0,1) = W l(0,2) = l(0,3) = K − 1 hζ 1 hζ (0,1) l 0 , l (0,1) 1 , l (0,1) 2 , l (0,1) 3 , l (0,1) 4 , (cid:104) (0,2) l 0 , l (0,2) 1 , l (0,2) 2 , l (0,2) 3 , l (0,n) 4 (cid:105) , (cid:104) (0,3) l 0 , l (0,3) 1 , l (0,3) 2 , l (0,3) 3 , l (0,3) 4 (cid:104) (cid:105) , (cid:105) 81 (4.32) (4.33) (4.34) (4.35) where γ is the determinant of the spatial metric, and Γii = γjj γkk − γjk γjk , Γij = γik γjk − γvivi, ∆ = h3W ζ ζ = Γii − i = 1 B − vivi, i C ± γij γkk , Γik = γij γjk − γjj γik , i + − C C i − , (cid:17) (4.36) 1 K − (cid:16) = vi (cid:17)(cid:16) Λi ± . − At times it will be necessary to renormalize the right-eigenvectors, e.g., for a barotropic equation of state the parameter K in Eq. (4.28) is singular since c2 s = (1/ρ)(∂p/∂ϵ )ρ (Rezzolla & Zanotti, 2013), and the left-eigenvectors are no longer given by the analytic expressions in Eq. (4.31) and Eqns. (4.33)–(4.35). In these cases, the left-eigenvectors are obtained from the numerical inverse of the renormalized right-eigenvector matrix. 4.2.2 Spatial Advection In the finite-difference discretization, the evolved conserved fluid variables are represented by the point-like values located at the cell-centers in the mesh. The spatial advection operator, ∂jFj(U), is evaluated by the difference of the spatial fluxes approximated at the interfaces of each cell. These interface fluxes are reconstructed from the characteristic projections of the variables and their spatial fluxes. Typically, finite-difference methods applied to hydrodynamics are unable to capture shocks that form in the solution without either using a finite-volume type Riemann solver to approximate the interface fluxes, or by attempting to smooth discontinuities by methods such as artificial viscosity. However, when evaluating the spatial advection operator along the characteristic trajectories that the fluid evolves along, shock and rarefaction waves that form in the solution can be resolved without relying on more approximate methods. 82 Following a similar method presented in Rezzolla & Zanotti (2013); Radice & Rezzolla (2012); Radice et al. (2014), the right- and left-eigenvector matrices are first computed at each interface using an average of the adjacent cells ¯R R ≡ (cid:16) ¯Ui+1/2 = ¯Ui+1/2 1 2 , ¯L ¯R− 1, ≡ (cid:17) Ui + Ui+1 (cid:16) . (cid:17) (4.37) (4.38) Next, the cell-centered conserved variables Ui and their spatial fluxes Fi ≡ i is limited to the range of the local reconstruction stencil S, are projected on to their Fj(Ui), where characteristic trajectories via the eigenvector matrices (Rezzolla & Zanotti, 2013) Wi = ¯LUi, Qi = ¯LFi. (4.39) (4.40) Then, a Lax-Friedrichs flux-splitting separates the characteristic fluxes into their rightward (+) and leftward (-) components (Radice et al., 2014) Q±i = Qi ± aWi, where the fastest characteristic speed in the stencil S is ,0 } λ{± i . a = max S i ∈ (cid:12) (cid:12) (cid:12) A weighted essentially non-oscillatory (WENO) method directly reconstructs the split (cid:12) (cid:12) (cid:12) characteristic fluxes at each interface. The specific reconstruction scheme here is based on 83 (4.41) (4.42) the fifth-order method presented in Jiang & Shu (1996) and a symmetric variant presented in Mart´ın et al. (2006). Fifth-order WENO methods are commonly used for both finite- volume and finite-difference discretizations in general relativistic hydrodynamics; see M¨osta et al. (2014) and Radice et al. (2014) for examples of each, respectively. In a finite-difference discretization, WENO methods use weighted combinations of the reconstructed flux from different stencils surrounding the interface. For fifth-order methods, each stencil consists of three cells surrounding the interface that is being reconstructed. The standard method presented in Jiang & Shu (1996) uses three sets of stencils biased in the upwind direction, while the symmetric variant in Mart´ın et al. (2006) adds a fourth stencil such that an equal number of cells to the left- and right-sides of the interface are present in the combined overall stencil. The following is adapted from the symmetric method presented in Mart´ın et al. (2006); this also includes the standard method when working with the reduced set of stencils. Let the full reconstruction stencil for the i + 1/2 interface be S = { S k = i + k { − S0, S1, S2, S3} , 2, i + k − 1, i + k (4.43) . } The split characteristic fluxes at the cell-centers are then interpolated to the i + 1/2 interface over each stencil as q±k = 2 (cid:88)l=0 aklQ±i+k+l 2, − (4.44) where akl are the interpolating coefficients for the k-th stencil. The weighted approximations 84 of the characteristic fluxes at the interface can then be found as 3 Q±i+1/2 = ωk q±k , (cid:88)k=0 (4.45) where the weights ωk associated with each stencil are the non-oscillatory weights normalized over all stencils ωk = ϖk 3 l=0 ϖl . (cid:80) The non-oscillatory weights are defined as ϖk = Ck ISk + ϵ , (4.46) (4.47) where ϵ is a small-parameter to avoid division by zero, Ck are the optimal weights, and ISk are the oscillation indicators ISk = 2 3 (cid:88)m=1 (cid:32) (cid:88)l=0 2 . dm klQ±i+k+l 2 − (cid:33) (4.48) For the symmetric set of stencils used here, the final stencil S3 is fully downwind of the i + 1/2 interface, so the final stencil’s oscillation indicator is set to the maximum of all values following the procedure in Mart´ın et al. (2006) IS3 = max 3 0 ≤ ≤ k ISk. (4.49) The coefficients akl, dm kl, and optimal weights Ck are from the fifth-order WENO-SYMOO 85 scheme in Mart´ın et al. (2006) and are provided here for reference: 1 3 − 1 6 7 6 5 6 − 1 3 11 6 − 5 6 − 7 6 11 6 1 3 1 6 1 3 d1 kl = 1 2 − 1 2 3 2 5 2 2 0 2 4            − − − 3 2 1 2 1 2 3 2   ,          − − d2 kl = b b b b            2b 2b 2b 2b − − − − b b b b   ,            ,          akl =            where b = 13/12, and (cid:112) Ck = (cid:20) 1 20 , 9 20 , 9 20 , 1 20 . (cid:21) (4.50) (4.51) The reconstructed split characteristic fluxes at the interfaces are then used to approximate the unsplit characteristic flux as Qi+1/2 = Q+ i+1/2 + Q−i+1/2. (4.52) Next, these are projected back to the spatial fluxes at the interface via the right-eigenvector matrix Fi+1/2 = ¯RQi+1/2. (4.53) Finally, the spatial advection operator for the j-th direction is evaluated in the i-th cell by using the reconstructed interface fluxes as ∂jFj(Ui) = Fi+1/2 − ∆x Fi 1/2 − , (4.54) 86 where ∆x is the width of the cell. 4.2.3 Recovering the Primitive Variables Similarly to the neutrino moment evolution equations, the fluid evolution equations must also be closed by specifying the pressure. While the pressure is readily obtained from an equation of state p(ρ, ϵ), the primitive variables necessary for evaluating the equation of state and the evolution equations, such as the rest-mass density ρ, internal energy ϵ, and the fluid velocity vi, are not as straightforward to obtain. They must be inverted from the conserved variables, Eq. (4.15), which is not a simple algebraic process in general relativistic hydrodynamics like it is in its Newtonian formulation. The conserved-to-primitive conversion is complicated by the presence of the Lorentz factor W , which leads to a highly non-linear relation between these sets of variables. As such, the only effective means of recovering the primitives is through numerical root-finding algorithms. A one-dimensional root-finding procedure is used to recover the primitive variables, ρ V = vi ϵ         ,       (4.55) from the conserved variables U in Eq. (4.15). This procedure is based on the method pre- sented in Rezzolla & Zanotti (2013), and parametrizes the relation between the conserved and primitive variables by the magnitude of the spatial projection of the fluid four-velocity z = γij uiuj = W v. (cid:113) 87 (4.56) To recover the variables in V as a function of the parameter z requires the Lorentz factor W , which can be found from z by using its definition W 2 = 1/ 1 v2 as − (cid:0) (cid:1) z2 = W 2v2 = W 2 1 − = ⇒ W (z) = 1 + z2. (4.57) (cid:112) Noting that D = ρW , the rest-mass density is trivially obtained as ρ(z) = D W (z) . (4.58) Next, the internal energy will require solving Eq. (4.2) for ϵ and eliminating h and p in terms of the conserved variables and z. It follows from Eq. (4.5) that i j S γij S h D ≡ (cid:113) z = S h D = ⇒ . h = S z D (4.59) Using Eq. (4.4) in τ = shows that E − D τ = (hW D 1) p − − = ⇒ p = (hW D 1) τ. − − (4.60) Finally, Eqns. (4.56)–(4.60) are used in Eq. (4.2) to express the internal energy as ϵ(z) = h p ρ − − 1 = W (z) τ + 1 D (cid:104) z S D − (cid:105) 1. − (4.61) The pressure is then obtained from the equation of state as p(z) = p[ρ(z), ϵ(z)]. (4.62) 88 Additionally, the fluid velocity is obtained from comparison of Eq. (4.59) to Eq. (4.56) as vi(z) = i S W (z)h(z)D , (4.63) where h(z) results from using Eq. (4.58) and Eqns. (4.61)–(4.62) in Eq. (4.2). The value of z that holds for the previous relations must now be solved for numerically. First, Eq. (4.59) is rewritten as the function P(z) = z = 0. − S h(z) D (4.64) For bracketed root-finding methods, a tightly-bounded range of possible z values will increase the convergence-rate of the solution. These bounds can be determined from the bounding values of the the magnitude of the fluid velocity, which can be found from the ratio of = τ + as D E k = S τ + = ρhW 2v ρhW 2 − . p D and S (4.65) The smallest value v can take occurs in the limit p/e = 1, while the largest value occurs when p = 0. Using these in Eq. (4.65) leads to (Rezzolla & Zanotti, 2013) 1 2 k v ≤ ≤ k < 1. Using these limits in Eqns. (4.56)–(4.57) then leads to the valid range of z values k − √4 z k2 ≤ ≤ √1 k − . k2 89 (4.66) (4.67) This provides a tight bracket around the root of Eq. (4.64), which is then solved for using the bracketed Brent method (Brent, 2002). From this obtained value of z and the conserved variables U, all primitive variables V and the pressure can be found from Eqns. (4.57)–(4.63) and the equation of state. 90 Chapter 5 Dynamic Spacetime Evolution In the presence of compact objects, such as black holes and neutron stars, the underlying ge- ometry of spacetime can no longer be assumed to be flat. Newtonian and special-relativistic treatments of the evolving neutrino radiation and fluid are not capable of fully capturing the effects of a curved spacetime through the simplistic use of a gravitational potential. Only a fully general relativistic description and treatment of the spacetime and its evolution equa- tions are capable of fully capturing the effects of the spacetime’s curvature and the influence of matter and energy on the spacetime. While stationary background spacetimes, such as the exterior of a non-rotating stationary black hole, may be suitable for some scenarios, an evolving spacetime will be necessary for studying neutron star mergers and the formation of compact remnants in core-collapse supernovae. An arbitrary spacetime is described by Einstein’s field equations of general relativity (Misner et al., 2017; Baumgarte & Shapiro, 2010) Rab − 1 2 gabR = 8πTab , (5.1) where Tab is the stress-energy tensor accounting for all matter and energy, including the contributions from both the fluid and neutrinos, gab is the spacetime metric, and the Ricci tensor and scalar are Rab = Rc acb, R = Ra a. 91 (5.2) (5.3) Eqns. (5.2)–(5.3) describe the intrinsic curvature of the spacetime in terms of the Riemann curvature tensor Ra bcd = ∂cΓa bd − ∂dΓa bc + Γa ecΓe Γa edΓe bc, bd − (5.4) where Γa bc are the Christoffel symbols defined in Eq. (C.12). Both Eq. (5.4) and the Christof- fel symbols assume that the spacetime is described by a coordinate basis (which will always be the case in this work). Taking the trace of Eq. (5.1) and using Eq. (5.3) also shows that R = 8πT, − (5.5) where T is the trace of the stress-energy tensor. Directly solving Eq. (5.1) is far from practical. A common approach is to decompose the spacetime into spacelike hypersurfaces at constant coordinate times, the so-called ‘3+1 split’ used in numerical relativity; see Baumgarte & Shapiro (2010) for a complete presentation of this method, and refer to appendix C for an overview of the notation and concepts used in this work. In this splitting, the lapse function α characterizes the distance between the hypersurfaces in time, the shift vector βi characterizes the spatial shift in coordinates along the proper timelike direction from one hypersurface to the next, the spatial metric γab measures distance in and projects on to the hypersurfaces, and the extrinsic curvature Kab describes the curvature of the hypersurfaces relative to the full spacetime manifold, such that the invariant line element associated with the spacetime takes the form ds2 = gab dxa dxb = − α2 dt2 + γij dxi + βi dt (cid:16) (cid:17)(cid:16) dxj + βj dt (cid:17) . (5.6) 92 Applying this splitting to Eq. (5.1) leads to a set of evolution equations for the spatial metric and extrinsic curvature, and the Hamiltonian and momentum constraint equations for energy and momentum conservation, respectively. The resulting equations, first proposed in Arnowitt et al. (1962), are referred to the Arnowitt, Deser and Misner (ADM) equations. Unfortunately, they are of limited practical use: this formalism assumes that the Hamiltonian and momentum constraints of the Einstein equations hold exactly, but outside of spherically symmetric or axisymmetric spacetimes, this can lead to numerical instabilities due to nu- merical errors causing violations of the constraints (Baumgarte & Shapiro, 2010). Instead, fully-constrained formulations or constraint-damping schemes can be used to stably evolve the spacetime. This chapter will describe two variations of a constraint-damping formalism for evolving the spacetime alongside the fluid and neutrinos, and the code generation utility developed to implement the resulting equations in numerical solvers. Their implementations in Flash-X will be described later in chapter 6. 5.1 Mathematical Formalism The elliptic form that the constraint equations take in the standard 3+1 splitting of Eq. (5.1) proves challenging to stably solve numerically. The Z4 formulation of the Einstein equations reduce the constraints to a more manageable system of first-order equations by introducing a new four-vector field Za, that when allowing for damping of constraint violations, puts Eq. (5.1) into the form (Gundlach et al., 2005) Rab − 1 2 gabR + ∇aZb + ∇bZa gab∇cZc − naZb + nbZa + κ2gabncZc κ1 − (cid:0) 93 = 8πTab , (5.7) (cid:1) where na is a normal to the spacelike hypersurface, and κ1, κ2 ≥ determine the strength of the damping. 0 are constants that This section will present the two decompositions of the Z4 formulation used in this work: the Z4c conformal decomposition as described in Bernuzzi & Hilditch (2010); Cao & Hilditch (2012), and the CCZ4 conformal and covariant decomposition as described in Alic et al. (2012); Radia et al. (2022). Both formulations will use the conformally-related variables χ = γ− 1 3 , ˜γij = χγij , 1 3 γij K , (cid:19) ˜Aij = χ Θ = − Kij − (cid:18) naZa, ˆΓi = ˜Γi + 2˜γijZj , (5.8) (5.9) (5.10) (5.11) (5.12) where χ is the conformal factor, ˜γij is the conformally-related spatial metric, ˜Aij is the trace-free part of the conformally-related extrinsic curvature, Θ is the timelike projection of the Z4 vector Za, and ˆΓi is a modification to the conformally-related connection function ˜Γi = ˜γjk ˜Γi jk, (5.13) where ˜Γi jk are the Christoffel symbols for the conformally-related spatial metric ˜γij found by using Eq. (5.9) in Eq. (C.12). The conformally-related quantities, indicated with a tilde, are purely spatial, i.e., they are orthogonal to the hypersurface normal na, and have indices raised and lowered by the conformally-related spatial metric. The spatial metric and extrinsic 94 curvature relate to these new variables as γij = Kij = 1 χ 1 χ ˜γij , ˜Aij + 1 3 γij K. (5.14) (5.15) The evolution and constraint equations will all make use of the Eulerian projections of the full stress-energy tensor, including contributions from all matter and energy sources, i.e., not just from the similarly-named fluid quantities, = nanbT ab, E i = S − ij = γi S γi anbT ab, aγj bT ab. (5.16) (5.17) (5.18) With these variables, the Hamiltonian and momentum constraints, and H M i, respectively, take the forms (Radia et al., 2022) = R + H i = ˜γjk M K2 2 3 − ˜Aki − ∂j (cid:16) ˜Aij ˜Aij ˜Γl ki 16π , − ˜Ajl − E ˜Γl kj ˜Ail − 3 ˜Aij∂k ln χ (cid:17) 2 3 − ∂iK 8π Si . − (5.19) (5.20) Two additional algebraic constraints also follow from the definitions of the conformally- related spatial metric and trace-free extrinsic curvature: det ˜γij = 1, ˜γij ˜Aij = 0. 95 (5.21) (5.22) The remainder of this section will present the two different Z4 formulations and the slicing and gauge conditions used in this work. Both formulations will define their evolution equations using the operator ∂0 ≡ ∂t − βk∂k , (5.23) which acts as the time-derivative in the direction of the hypersurface normal na. Covariant derivatives with respect to the spatial metrics will be computed as DiXj ˜Di ˜Xj k = ∂iXj ˜Xj k = ∂i k + Γj k + ˜Γj ilXl k − ˜Xl k − il Γl ikXj l , ˜Γl ˜Xj l , ik (5.24) (5.25) for some arbitrary tensor Xj k , where ˜Γi jk are the Christoffel symbols of the conformally- related spatial metric found from using Eq. (5.9) in Eq. (C.12). Additionally, both formula- tions will also make use of trace-free components of various rank-two tensors; these quantities will be denoted by the superscript “tf” and represent the operations, again for an arbitrary rank-two tensor Xij and its conformally-related counterpart, Xtf ij = Xij − ˜Xtf ij = ˜Xij − 1 3 1 3 γij ˜γij γklXkl ˜γkl ˜Xkl , . (cid:17) (cid:17) (cid:16) (cid:16) (5.26) (5.27) 5.1.1 Z4c The Z4c formulation results from the conformal 3+1 decomposition of the Z4 system in Eq. (5.7) while discarding non-primary non-damping terms, and is based on the formulations 96 presented in Bernuzzi & Hilditch (2010); Cao & Hilditch (2012). This formulation directly evolves the conformally-related χ, ˜γij , ˜Aij, Θ, and ˜Γi, as well as the modified trace of the extrinsic curvature ˆK = K 2Θ. − The evolution equations for these variables are ∂0χ = 2 3 ∂0 ˜γij = − ˆK = ∂0 − ∂0 ˜Aij = χ α ∂k βk ˆK + 2Θ (cid:16) − (cid:104) (cid:17) 2α ˜Aij + ˜γki∂j βk + ˜γkj ∂iβk (cid:105) , 1 3 (cid:16) DkDkα + α ˜Ajk ˜Ajk + (cid:20) DiDj α + α (cid:16) − (cid:104) Rij − + ˜Aki∂j βk + ˜Akj∂iβk 2 1 3 2 ˜Aij + ˜Aij R α 8π Sij (cid:17)(cid:105) ˜Aij∂k βk, 2 2 3 − ˆK + 2Θ − (cid:16) ∂j ln χ 3 2 (cid:17) ˜γij∂j 1 3 − ∂0Θ = ˆΓi = 2α ∂0 jk (cid:20) ˜Γi − ˜Ajk − (cid:20) 2 2 ˜Aij∂j α + 3 − 2 3 − ˆK + 2Θ ˜γij ∂k βk, 2 tf (cid:17) + α + κ1(1 + κ2)Θ (cid:21) ˜Aij − (cid:17) ˆK + 2Θ + 4πα( + ), S E 2˜γkl ˜Aik ˜Alj (cid:105) (cid:104)(cid:16) 16π E − ˆK + 2Θ , 2κ1(1 + κ2)Θ (cid:21) ˜Γi ˆΓi κ1 − − (cid:16) (cid:17) (cid:16) (cid:17) 1 ˜γij∂j ∂k βk, 3 8π˜γij Sj (cid:21) − ˜Γi∂k βk − ˜Γj∂j βi + ˜γjk∂j ∂k βi + (5.28) (5.29) (5.30) (5.31) (5.32) (5.33) (5.34) where = γij S S ij. The Ricci tensor is separated into terms proportional to the derivatives of the conformal factor and the derivatives of the conformally-related spatial metric, Rχ ij and ˜Rij, respectively, as Rij = Rχ ij + ˜Rij, (5.35) 97 where Rχ ij = ˜Rij = ˜Di 1 2χ (cid:104) 1 ˜γki∂j 2 (cid:104) + ˜γlm ˜Γk (cid:104) ˜Dj χ + ˜γij ˜γkl ˜Dk ˜Dlχ 1 4χ2 − (cid:105) ∂iχ∂j χ + 3˜γij ˜γkl∂k χ∂l χ (cid:104) ˆΓk + ˜γkj ∂i ˆΓk ˜γkl∂k ∂l ˜γij + ˜Γk ˜Γijk + ˜Γjik ˜Γjkm + ˜Γk li lj − ˜Γikm + ˜Γk ˜Γklj im (cid:16) . (cid:105) (cid:17)(cid:105) (cid:105) (5.36) (5.37) 5.1.2 CCZ4 The CCZ4 formulation similarly results from the conformal 3+1 decomposition of Eq. (5.7), but unlike Z4c, its evolution equations remain fully-covariant (Alic et al., 2012). This section will describe a CCZ4 formulation based on the one presented in Radia et al. (2022). Similarly to Z4c, this formulation also evolves the conformally-related χ, ˜γij , ˜Aij, Θ, and ˜Γi, but instead directly evolves K, the trace of the extrinsic curvature. The evolution equations presented here, which are based on the ones in Radia et al. (2022), differ from the original formulation in Alic et al. (2012) primarily by the modification of the Ricci tensor and scalar to absorb terms proportional to the covariant derivatives of Zi that appear in the CCZ4 equations. This modification allows the conformally-related Ricci tensor to be written in terms of the evolved ˆΓi and its derivatives, instead of the connection functions ˜Γi, ˆRij = Rij + DiZj + Dj Zi = ˜Rij + Rχ ij + RZ ij, (5.38) where ˜Rij and Rχ ij are still defined as in Eqns. (5.37)–(5.36), and RZ ij = Zk χ2 (cid:16) ˜γik ∂j χ + ˜γjk ∂iχ − ˜γij ∂k χ , (cid:17) (5.39) 98 where Zi = γi aZa is the spatially-projected Z4 vector. The evolution equations for the conformal factor and the conformally-related metric are exactly the same as their Z4c equations in Eqns. (5.29)–(5.30). The new evolution equation for CCZ4 are ∂0K = − ˜Aij = χ ∂0 ∂0Θ = ˆΓi = ∂0 8π − (cid:104) DkDkα + α ˆR + K(K (cid:104) DiDj α + α ˆRij − (cid:16) + ˜Aki∂j βk + ˜Akj∂iβk 2 1 3 2 Zi χ (cid:33) − (cid:20) ∂k βk ˜Γi + 2κ3 − K2 ˜Aij + 2 3(cid:34) ˜Aij 2 3 ˆR (cid:32) − α − 2Θ) − + 4πα( − tf 3ακ1(1 + κ2)Θ (cid:105) 2Θ) ˜Aij − (K + α − S − 2˜γkl ˜Aik ) 3 E ˜Alj (cid:105) Sij (cid:17)(cid:105) ˜Aij∂k βk, (cid:104) 2ΘK 16π − ˜Γk + 2κ3 3 2 (cid:32) 2κ1(2 + κ2)Θ (cid:21) ∂k βi 2α (cid:35) − 2 3 E − Zk χ (cid:33) Zk∂k α, − Zi χ (cid:21) K + κ1 (cid:20) 16πα˜γij (5.40) (5.41) (5.42) 4 3 α − (cid:20) + 2˜γij ˜γij∂j K + 3 ˜Aij∂j ln χ − (cid:21) 2 ˜Aij∂j α + 2α˜Γi jk ˜Ajk − α∂j Θ − (cid:104) Θ∂j α + ˜γjk∂j ∂k βi + (cid:105) 1 3 ˜γij∂j ∂k βk, Sj (5.43) where κ3 is an additional constant not present in the Z4c equations, and determines the full covariance of the evolution equations. Setting κ3 = 1 results in a fully-covariant system, but this can lead to numerical instabilities when there is non-linear coupling between the various damping terms; these effects can be present in black hole spacetimes, where it is beneficial to set κ3 = 1/2 (Alic et al., 2012). Alternatively, the replacement ακ1 → evolution of black hole spacetimes when setting κ3 = 1 (Radia et al., 2022). κ1 permits stable 5.1.3 Slicing and Gauge Conditions The choice of slicing and gauge conditions determine the evolution of the lapse and shift. At present, both formulations make use of the moving puncture gauge conditions, which are a 99 combination of ‘1+log’ slicing for the lapse and a hyperbolic Γ-driver shift, and are given in Baumgarte & Shapiro (2010) as 2αK, Bi, ∂0α = ∂0βi = − 3 4 ∂0Bi = ∂0 ˆΓi − ηBi, (5.44) (5.45) (5.46) where η is a damping parameter; for spacetimes outside of a compact object of mass M , this parameter will be of the order η = O (1/(2M )). Different variations of these gauge conditions, e.g., a harmonic lapse slicing and a non-hyperbolic Γ-driver shift presented in Cao & Hilditch (2012), can also be used alongside the different Z4 formulations, but Eqns. (5.44)–(5.46) will prove useful in testing these formulations in vacuum and black hole spacetimes. 5.2 Numerical Methods For use in the description of the numerical methods applied to the Z4 formulations in the preceding section, the evolution equations will be written in the form ∂tV − βj∂j V = E V, ∂iV, ∂i∂j V , (cid:16) (cid:17) where the vector of evolved variables is χ, ˜γij , ˆK, ˜Aij, Θ, ˆΓi, α, βi, Bi χ, ˜γij , K, ˜Aij, Θ, ˆΓi, α, βi, Bi T (cid:105) T (Z4c) . (CCZ4) (cid:105) V =    (cid:104) (cid:104) 100 (5.47) (5.48) The function E represents the the right-hand sides of the either the Z4c or CCZ4 evolution equations (omitted here for brevity) and contains an explicit dependence on the evolved variables and their spatial first- and second-derivatives. Both the Z4c and CCZ4 formulations utilize a finite-difference spatial discretization. For compatibility with the neutrino radiation and hydrodynamics solvers described in chapters 3– 4 and the mesh structures available in Flash-X, the evolved metric and curvature variables are located at the cell-centers. All derivatives in the right-hand side function E use centered fourth-order accurate differences of the form ∂iV ∂i∂j V DiV, DijV, ≈ ≈ (5.49) (5.50) where the difference operators are are generated with the Python package SymPy (Meurer et al., 2017) and take the forms DiV = Vi 2 − − 8Vi 1 + 8Vi+1 − − 12∆xi Vi+2 , (5.51) and where the i DijV =    Vi − − 2 + 16Vi 1 − − 12 30Vi + 16Vi+1 − ∆xi 2 Vi+2 (cid:0) (cid:1) DiDjV i = j i = j , (5.52) = j case represents the consecutive applications of the first-derivative difference operator along each direction. The advective derivatives along the shift utilize an upwind- 101 ̸ ̸ biased derivative for stability (Cao & Hilditch, 2012; Radia et al., 2022) j V, βjD+ βj∂j V ≈ 10Vi + 18Vi+1 − 12∆xj 18Vi − 12∆xj 2 − − 3Vi − 1 − Vi − 3 + 6Vi 6Vi+2 + Vi+3 1 + 10Vi + 3Vi+1 (5.53) βj > 0 βj < 0 . − − D+ j V =    Similarly to the hydrodynamics solver described in chapter 4, both the Z4c and CCZ4 implementations make use of a method-of-lines time discretization and the fourth-order accurate Runge-Kutta explicit method. When using an implicit-explicit (IMEX) method for integrating the neutrino moment evolution equations, a fourth-order accurate IMEX method will be necessary. As is common practice in numerical relativity, the time-derivative operators are modified to include Kreiss-Oliger dissipation (Baumgarte & Shapiro, 2010; Rezzolla & Zanotti, 2013). Following the methods used in Cao & Hilditch (2012); Radia et al. (2022), sixth-order dissipation is added by re-defining the time-derivative operator as ∂tV ∂tV σ − → (cid:88)i Vi 3 − − 6Vi − 2 + 15Vi − 1 − 20Vi + 15Vi+1 − 64∆xi 6Vi+1 + Vi+3 , (5.54) where σ is a constant specifying the strength of the dissipation. This change is not made at the level of the time-integrator, but is accounted for by adding the dissipation term in to the evaluation of the right-hand sides of the evolution equations. 5.3 Code Generation Implementing the evolution equations for either the Z4c or CCZ4 formulations is far from a straightforward exercise. Evaluation of the evolution equations and the derived, composite 102 quantities, such as the Ricci tensor, require copious amounts of tensor algebra. Manual translation of the symbolic forms of the evolution equations presented in this chapter into component-wise equations and operations in any programming language suitable for large- scale numerical simulations is as error prone as it is tedious. A common approach in numerical relativity is the use of code generators to translate these symbolic expressions into usable code. A number of code generation packages exist, typically targeted at specific numerical relativity codes, with some recent examples being NRPy+ for the Einstein Toolkit (Ruchlin et al., 2018), and STvAR for AMReX-based codes (Peterson et al., 2023). While these code-generators work well alongside their intended target codes, the utilities and assumptions specific to their respective codes are not directly adaptable elsewhere. This section will describe a set of code generation utilities that originally began as an extension of STvAR for use in Flash-X to produce Fortran code, but subsequently underwent a complete re-design to facilitate use and re-usability, and improve the quality and readability of the generated Fortran code. The new code generation capabilities aim to extend existing capabilities in the open- source symbolic algebra Python package SymPy (Meurer et al., 2017). SymPy includes a robust tensor algebra module (sympy.tensor.tensor) that unfortunately is not compatible with its existing code generation and printing utilities. Due to this limitation, modules and data structures compatible with the existing SymPy code generation utilities, e.g. IndexedBase, are typically used directly in loop-based calculations of tensorial equations. The approach taken here will instead connect SymPy’s symbolic tensor algebra and code generation capa- bilities. Extensions to the symbolic tensor algebra module will provide replacement rules for converting symbolic tensorial expressions into sets of data-types and expressions compati- ble with the abstract syntax tree nodes used by the code generation and -printing utilities. 103 New and updated abstract syntax tree nodes will then automate the application of these replacement rules when used in an updated modern Fortran code printer. 5.3.1 Symbolic Tensor Algebra In SymPy’s symbolic tensor algebra module, symbolic tensors and their indices are represented by the TensorHead and TensorIndex data-types, respectively. These are then used to form three types of symbolic expressions: indexed expressions representing a specific tensor, and expressions for addition and products of other expressions. These allow for translating tensor equations directly into tensor expressions by making use of an Einstein summation notation. Code snippet 5.1 provides an example of this procedure by constructing a symbolic tensor expression for the trace of the extrinsic curvature, K = γijKij . Both the tensors and their indices rely on the specification of a TensorIndexType to match the defined tensor indices to the tensor “slots” they can be used in. Additionally, each tensor is constructed as fully- symmetric by providing a TensorSymmetry object. The final line demonstrates two types of tensor expressions: the indexed expressions gamma(i,j) and K(-i,-j), and the product expression of these two indexed expressions. In this notation, i,j represent contravariant (raised) indices, and -i,-j represent covariant (lowered) indices. This expression assumes these indices are fully-contracted such that the overall product results in a scalar expression. The individual and composite tensor expressions only specify the tensors and operations involved, but do not specialize to a specific basis, dimension, or values until they are eval- uated. This evaluation occurs by applying replacement rules to indexed tensor expressions with arrays containing values or other symbolic expressions that represent individual ten- sor components. The replacement array must be of the same rank as the target indexed tensor expression, and the array’s dimensions will determine the tensor’s dimensions. This 104 # A basic type for all tensor indices spatial = TensorIndexType("spatial") # Symmetry specification for a fully symmetric rank-2 tensor sym = TensorSymmetry.fully_symmetric(2) # Symbolic tensor indices i = TensorIndex("i", spatial) j = TensorIndex("j", spatial) # Spatial metric and extrinsic curvature tensors gamma = TensorHead("gamma", [spatial]*2, sym) K = TensorHead("K", [spatial]*2, sym) traceK = gamma(i,j)*K(-i,-j) Code Snippet 5.1: Example symbolic tensor expressions using sympy.tensor.tensor process is demonstrated in code snippet 5.2 by evaluating the Eulerian decomposition of the fluid four-velocity in terms of two symbolic tensors for the fluid velocity va and hyper- surface normal na, and the scalar Lorentz factor W represented by a SymPy Symbol object. The replacement rules are provided as a Python dictionary associating each indexed tensor expression with a list of symbols for each component. While these symbolic tensor expressions provide a powerful set of tools for evaluating tensorial equations, there are a few limitations that complicate their use in code generation. Each tensor object can be indexed with either raised or lowered indices, e.g., n(a) and n(-a). This requires either separate replacement rules for each possible index configuration, or the association of a metric with the underlying index types. The former option is error-prone as each possible index configuration must be manually specified, which can become increas- ingly convoluted for higher-rank tensors. The latter option unfortunately only works well with simple analytic metric, e.g., Minkowski or Schwarzschild, while more generic metrics, e.g., ones with just named symbols for components representing their evolved values, do 105 # Index type for the four-vectors spacetime = TensorIndexType("spacetime") # Symbolic index a = TensorIndex("a", spacetime) # Fluid velocity and normal vectors v = TensorHead("v", [spacetime]) n = TensorHead("n", [spacetime]) # Lorentz factor W = Symbol("W") # Eulerian decomposition of the four-velocity u = W*(n(a) + v(a)) # Evaluate by replacing tensor components with SymPy Symbol objects u.replace_with_arrays({ n(a): symbols("nt,nx,ny,nz"), v(a): symbols("vt,vx,vy,vz") }) # Produces a list with scalar expressions for each component [ W*(nt + vt), W*(nx + vx), W*(ny + vy), W*(nz + vz) ] Code Snippet 5.2: Evaluating symbolic tensor expressions with sympy.tensor.tensor not efficiently work with the internal inversion and contractions performed when evaluating tensor expressions. Another limitation is a lack of symbolic operators compatible with the tensor expressions. SymPy only provides one operator, PartialDerivative, that cannot directly be replaced (only its operands can), and can only be evaluated analytically, e.g., provided γθθ = r2 it will be able to evaluate ∂r γθθ = 2r. The remainder of this section will describe extensions to SymPy’s symbolic tensor algebra capabilities that improve on these limitations. As previously mentioned, manually providing replacement rules for all possible index configurations can become increasingly complex, particularly when dealing with the large 106 systems of equations present in numerical relativity. This can become even more complex when multiple representations are necessary, e.g., when a tensor component needs a scalar and grid variable representation in the final generated code. To reduce this complexity, this work extends TensorHead to generate a series of replacement rules based on the provided tensor name, symmetries, and index configuration. These replacement rules use an Indexed object formed from an IndexedBase, representing the tensor and its index configuration, and series of symbolic integers, representing specific components of the tensor. The index config- uration, which will be specific to and enforced for each tensor, is included in the IndexedBase with a sequence of L and U characters for covariant (lower) and contravariant (upper) index slots, respectively. Since this is targeted at numerical relativity, tensors will all be consid- ered four-dimensional, with an optional spatial-only flag that produces only non-zero spatial components. This new functionality is included in a new derived class SymbolicTensor that inherits the full tensor expression capabilities of TensorHead. Code snippet 5.3 provides an example of using SymbolicTensor to generate a TensorHead and its replacement rules for the spatial Christoffel symbols Γi jk; these replacement rules produce Indexed objects for each component that represent a compact form that reduces the symmetric index slots to a single rank representing only the unique components. Each symbolic tensor will also generate a set of replacement rules in terms of grid vari- ables, i.e., when individual components of a tensor are stored in a larger data structure representing potentially many variables located on a computational grid. The naming rules used for the local variable names will be applied to a named integer constant used to index the grid data structure. To facilitate their use within loops over the grid, these replacement rules will additionally take a set of grid indices that can either take specific numeric values or represent an integer variable used as a loop counter. All grid-variable replacement rules 107 # Spatial index type spatial = TensorIndexType("spatial") # Tensor indices i,j,k = tensor_indices("i,j,k", spatial) # New wrapper around TensorSymmetry to aid in replacement-rule generation # This example specifies that the 1,2 slots (out of 0,1,2) are symmetric sym = Symmetries(Symmetric([1,2])) # Christoffel symbol Gamma^i_jk Gamma_ull = SymbolicTensor( "Gamma", [Contravariant,Covariant,Covariant], sym, spatial=True ) # Apply the replacement rules Gamma_ull(i,-j,-k).replace_with_arrays(Gamma_ull.repl) # Produces the list (where X..Z and XX..ZZ are integer symbols) # The underlying array that each component belongs to will # be in a compact form as determined by the tenor's symmetry, # i.e its shape will be (X:Z, XX:ZZ) [[[ Gamma_ULL(X,XX), Gamma_ULL(X,XY), Gamma_ULL(X,XZ) ], [ Gamma_ULL(X,XY), Gamma_ULL(X,YY), Gamma_ULL(X,YZ) ], [ Gamma_ULL(X,XZ), Gamma_ULL(X,YZ), Gamma_ULL(X,ZZ) ]], ..., [[ Gamma_ULL(Z,XX), Gamma_ULL(Z,XY), Gamma_ULL(Z,XZ) ], [ Gamma_ULL(Z,XY), Gamma_ULL(Z,YY), Gamma_ULL(Z,YZ) ], [ Gamma_ULL(Z,XZ), Gamma_ULL(Z,YZ), Gamma_ULL(Z,ZZ) ]]] Code Snippet 5.3: Automatic replacement rule generation with SymbolicTensor also can specify prefixes and suffixes to allow for compatibility with naming conventions in the targeted code. See code snippet 5.4 for an example of the grid-variable replacement rules again applied to the Christoffel symbols Γi jk. A similar SymbolicScalar extends Symbol to also include the generation of grid-variable replacement rules for scalar symbols. With the large number of different types of derivative operators in the Z4c and CCZ4 equations, manually creating symbolic tensors for each tensor and all of its different deriva- 108 # Gamma_ull previously defined as Christoffel symbol # Grid dimensions NVAR,NX,NY,NZ = symbols("NVAR,NX,NY,NZ", integer=True) # Grid indices inds = symbols("I,J,K", integer=True) # Represent array of grid variable data as an IndexedBase vars = IndexedBase("vars", shape=(NVAR,NX,NY,NZ)) # Apply the grid replacement rules Gamma_ull(i,-j,-k).replace_with_arrays( Gamma_ull.as_grid_repl(vars, inds, suffix="_VAR")) # Produces the list of grid variables [[[ vars(GAMMA_ULL_XXX_VAR, I, J, K), ... ], [ vars(GAMMA_ULL_XXY_VAR, I, J, K), ... ], [ vars(GAMMA_ULL_XXZ_VAR, I, J, K), ... ]], ..., [[ vars(GAMMA_ULL_ZXX_VAR, I, J, K), ... ], [ vars(GAMMA_ULL_ZXY_VAR, I, J, K), ... ], [ vars(GAMMA_ULL_ZXZ_VAR, I, J, K), ... ]]] Code Snippet 5.4: Automatic replacement rule generation with SymbolicTensor for named variable indices in a grid data structure. tives would be incredibly cumbersome. A new TensorOperator class alleviates these re- dundancies by inlining the creation of new SymbolicTensor objects and expressions with updated names and ranks. For example, a partial derivative operator applied to the spatial metric, i.e., ∂k γij , will produce a new set of replacement rules for a rank-three tensor and prepend the operator name to the tensor’s base name. This procedure is demonstrated in code snippet 5.5 for the non-inline application of a tensor operator to emphasize the necessary steps and the creation of the new symbolic tensor expression. Additional utilities for working with symbolic tensors are also included. Common linear algebra operations such as taking the determinants and inverse of rank-2 tensors, are special- 109 # Spatial index type spatial = TensorIndexType("spatial") # Tensor indices i,j,k = tensor_indices("i,j,k", spatial) # Fully symmetric in first two indices sym = Symmetries(Symmetric([0,1])) # Spatial metric gamma_ij gamma_ll = SymbolicTensor("gamma", [Covariant]*2, sym, spatial=True) # Spatial derivative operator d = TensorOperator("d", [Covariant], spatial=True) # Apply the operator (this can also be done inline in an expression # or during application of the replacement rules) dgamma_lll = d(gamma_ll(-i,-j), k) # Apply the replacement rules dgamma_lll.replace_with_arrays(dgamma_lll.repl) # Produces the list representing the metrics derivatives [[[ dgamma_LLL(XX,X), dgamma_LLL(XX,Y), dgamma_LLL(XX,Z) ], [ dgamma_LLL(XY,X), dgamma_LLL(XY,Y), dgamma_LLL(XY,Z) ], [ dgamma_LLL(XZ,X), dgamma_LLL(XZ,Y), dgamma_LLL(XZ,Z) ]], ..., [[ dgamma_LLL(XZ,X), dgamma_LLL(XZ,Y), dgamma_LLL(XZ,Z) ], [ dgamma_LLL(YZ,X), dgamma_LLL(YZ,Y), dgamma_LLL(YZ,Z) ], [ dgamma_LLL(ZZ,X), dgamma_LLL(ZZ,Y), dgamma_LLL(ZZ,Z) ]]] Code Snippet 5.5: Applying a TensorOperator to a SymbolicTensor to generate new re- placement rules. ized to take an input symbolic tensor and generate expressions based on the associated re- placement rules. Finite-difference weights are generated with SymPy’s finite diff weights utility, and then used to create finite-difference operators of arbitrary orders, directions and accuracies. These operators allow the accuracy and bias of the first- and second-order deriva- tives, as well as the Kreiss-Oliger dissipation terms, to easily be changed when generating 110 the subroutines for calculating both the right-hand sides for the Z4c and CCZ4 evolution and constraint equations. 5.3.2 Code Printing SymPy provides robust code generation and printing utilities that can take certain symbolic expressions and automatically transform them into usable lines of code for a target program- ming language. The code generators and printers both utilize an abstract syntax tree (AST) that represents features common in most programming languages, such as arithmetic oper- ations and assignments. The general ASTs are also augmented by language-specific nodes representing language-specific constructs, data-types, and library functions. SymPy expres- sions make use of a similar tree structure, and in most cases can be automatically parsed into a set of AST nodes for use in code generation. Unfortunately, not all data-types and expressions are compatible with the ASTs and code generation utilities. Simple expressions containing Symbol, Indexed, and similar objects are supported directly in all code generators and printers, but there is no built-in support for the symbolic tensor expressions. Additionally, while some languages’ code generators and printers are well maintained and supported, such as those targeting C and C++, others contain a hodgepodge of dated usage and formatting assumptions alongside a smattering of modern features, such as the ones for Fortran. Since Fortran is the target language for implementing the Z4c and CCZ4 equations in Flash-X, these concerns will be addressed alongside updates to the AST to support symbolic tensor expressions. The replacement rules for symbolic tensor expressions presented in the previous section all make use of code generation compatible data-types, specifically by using Symbol and Indexed objects. Once these replacements are applied, each element in the resulting arrays is 111 an expression that can directly be converted into a series of AST nodes. In all practical cases, these expressions will be evaluated for assignment operations, which are represented by the Assignment AST node. Two new AST nodes, ScalarAssignment and TensorAssignment, eliminate the need to manually create these nodes for each component of a tensor expression. Each of these directly take the left- and right-hand sides of a symbolic tensor expression, automate the application of the replacement rules, and generate a set of Assignment nodes for the unique components. TensorAssignment nodes can either take indexed or non-indexed expressions; the latter will produce elemental array operations and assignments in Fortran. As this code generator is aimed at producing Fortran code, a number of new Fortran- specific AST nodes have been added. The ScalarDeclaration and TensorDeclaration nodes provide simple ways of adding variable declarations for the new symbolic types. New attributes such as target and optional are included for variable declarations; previously only intent, dimension, parameter, and allocatable were supported. ConditionalBlock nodes provide a flexible way for adding multi-part conditional statements that are not easily represented by the Piecewise construct. SymPy’s Fortran code printer produces merge(...) statements for piecewise expressions when using standards more recent than Fortran77; the merge intrinsic function is intended for masked array assignments (Metcalf et al., 2018) and can be an inefficient option when the desired outcome is that only one case is evaluated, as both the true and false cases will be evaluated as inputs to merge. A NestedDo node simplifies the creation and formatting of nested do loops. New pre-processor nodes and tokens for #include, #define, and #if...#else...#endif blocks are introduced; these are used extensively in Flash-X for conditionally compiling code based on the chosen spatial dimension. CodeBlock nodes are extended to include an optional comment-string to prepend to the block for enhanced readability and formatting. 112 These features are all collectively used in a new ExtendedSubroutine node that facil- itates creating new procedures by separately accepting input parameters, use statements, declarations, and the body of the procedure. The standard Subroutine node only accepted basic SymPy types as input parameters and placed them immediately prior to the body of the subroutine without allowing for implicit none or use statements. This new node also parses all included tensor and scalar assignment blocks for all variable names, categorizes them by type and dimension, and creates declarations (sorted by type and dimension) for variables with no provided declarations. This greatly simplifies and reduces potential error in declaring all locally-used intermediate variables in longer sets of calculations. A new Fortran code printer, ModernFCodePrinter derives functionality from SymPy’s FCodePrinter, updates formatting rules, and adds support for the new AST nodes. Dated conventions in the previous code printer are removed, such as the non-standard-conforming type specification real*8. The basic formatting and line-wrapping rules were updated to produce more-readable output code. Previously, lines were wrapped at the first encountered word-boundary or operator, and continued at a fixed indentation on subsequent lines. For some of the longer equations present in the spacetime solvers, this produced code that was incredibly hard to inspect for correctness. A new set of rules now seeks to wrap lines at the boundary of a set of terms, and when possible avoids breaking a line inside of an innermost set of parentheses in an effort to keep array indices together on the same line. Line continuations made for assignments and declarations will now align to the start of the right-hand side in the first line of the statement to improve readability. For the previously stated concerns, the use of merge was also removed for Piecewise input. For better compatibility with Flash-X, floating-point literals are now no longer expressed in a X.YdZ format; Flash-X requires use of real and X.YeZ notation and sets the default real type at compile time (defaults to 113 double-precision). The new AST nodes and code printing capabilities are demonstrated in code snippets 5.6– 5.7. These examples illustrate the creation of a subroutine for removing the trace from a rank-two tensor as shown in Eq. (5.26). In code snippet 5.6, the input and output tensor are defined and added as parameters of the subroutine. A use statement for a tensor indexing module is added next; this module is assumed to define the named integer constants repre- senting the numeric values of the array indices present in the tensor expression replacement rules. The body of the subroutine includes an indexed expression for the trace of the tensor, and a non-indexed expression removing this trace in the output tensor. Finally, this sub- routine is passed to the Fortran code printer for parsing and formatting. Trace and Inv are specialized TensorOperator objects; Trace produces a SymbolicScalar representing the trace of the tensor, while Inv produces a SymbolicTensor for the provided tensor’s inverse by flipping its index configuration. The generated code is displayed in code snippet 5.7. The code printer generates the argument list in the provided order of the input and output variable declarations. Parsing of the subroutine’s body identifies one locally-used intermediate variable that no declaration was provided for, trX, and generates the necessary variable declaration. The first assignment illustrates the output form of an indexed symbolic tensor expression and demonstrates the new line wrapping and indentation rules. The final assignment shows the elemental array operation and assignment generated by the non-indexed symbolic tensor expression. 114 # Tensor indices i, j = tensor_indices("i,j", spatial) # Symmetric in first two ranks sym = Symmetries(Symmetric(0, 1)) # Input/Output tensors X_ll = SymbolicTensor("X", [Covariant]*2, sym, spatial=True) gam_ll = SymbolicTensor("gam", [Covariant]*2, sym, spatial=True) gam_uu = Inv(gam_ll) # Create the subroutine subroutine = ExtendedSubroutine("remove_trace", # Input/output parameters params_decls = [ TensorDeclaration(X_ll, real, [intent_inout]), TensorDeclaration(gam_ll, real, [intent_in]), TensorDeclaration(gam_uu, real, [intent_in]), ], # Module defining integer tensor indices uses = [use("tensor_indexing")], # Body of the subroutine body = [ ScalarAssignment( # LHS Trace(X_ll), gam_uu(i, j) * X_ll(-i, -j), # RHS comment="Trace of X" ), TensorAssignment( X_ll, # LHS X_ll - Rational(1, 3) * gam_ll * Trace(X_ll), # RHS comment="Remove trace from X", ), ] ) # Print the subroutine print(fortrancode(subroutine)) Code Snippet 5.6: Generating a subroutine for a symbolic tensor expression 115 subroutine remove_trace(X_LL, gam_LL, gam_UU) use tensor_indexing implicit none real, dimension(XX:ZZ), intent(inout) :: X_LL real, dimension(XX:ZZ), intent(in) :: gam_LL real, dimension(XX:ZZ), intent(in) :: gam_UU real :: trX ! Trace of X trX = X_LL(XX)*gam_UU(XX) + 2*X_LL(XY)*gam_UU(XY) + & 2*X_LL(XZ)*gam_UU(XZ) + X_LL(YY)*gam_UU(YY) + & 2*X_LL(YZ)*gam_UU(YZ) + X_LL(ZZ)*gam_UU(ZZ) ! Remove trace from X X_LL = -(1.0/3.0)*trX*gam_LL + X_LL end subroutine remove_trace Code Snippet 5.7: Formatted Fortran output produced by code snippet 5.6 116 Chapter 6 General Relativistic Solvers in Flash-X The general relativistic solvers presented in chapters 3–5 are each implemented in Flash-X, a composable multi-physics software framework ideally suited for large-scale simulation of astrophysical events (Dubey et al., 2022). The architecture of Flash-X readily enables the addition of new physics and numerical methods modules, and provides access to many nu- merical capabilities, such as adaptive mesh refinement, and utilities, such as parallel input- output (I/O). A custom build system offers flexibility in composing simulations by includ- ing different implementations of physics, numerical, and utility modules accessible through commonly-defined interfaces. This chapter will describe the implementation and testing of the general relativistic solvers and their supporting modules. The radiation transport module GRM1 implements the neutrino M1 formulation in chapter 3. The hydrodynamics module GRFD implements the high-order finite-difference method presented in chapter 4. The new Spacetime physics module implements the Z4c and CCZ4 formulations using the code-generator as presented in chapter 5. A new time integration module provides a method-of-lines discretization as an alternative to the operator-split method that delegated time-integration responsibility to each physics solver. To the extent that it is possible, the implementation of each solver is designed to sep- arate the physics, numerical methods, and runtime controls. This mimics the model-view- controller and delegation design patterns (see Gamma et al. (1995) for more information on these and other design patterns). Runtime controls interact directly with Flash-X and serve as the entry points into the solvers for various tasks. These controls orchestrate and dele- 117 gate responsibility to the numerical methods to perform calculations. In turn, the numerical methods rely on specific physics calculations. Each level of this design is made as agnostic to the others as much as possible. This facilitates adding, removing, updating, and debugging individual features by isolating specific sets of functionality to separate pieces of the code. This modular design also provides increased adaptability, e.g., the neutrino finite-volume and finite-difference discretization implementations can be swapped with one another while still using the same runtime controls and physics implementations. 6.1 Time Integration The TimeAdvance module in Flash-X manages the evolution of a simulation. Previously, this module only implemented an operator-split method that consecutively passed control to each physics module to perform a single full time-step update. In this method, an update from the n-th to (n + 1)-th time-step of size ∆t takes the form Vn+1 hy = Ghy rt G Vn+1 rt = Vn+1 sp = tn, ∆t, Vn hy, Vn rt, Vn sp, . . . (cid:16) tn, ∆t, Vn+1 hy , Vn rt, Vn (cid:17) sp, . . . , , (6.1) (cid:16) sp tn, ∆t, Vn+1 hy , Vn+1 rt , Vn (cid:17) sp, . . . (cid:17) , (cid:16) G where tn is the time at the start of the time-step, and V and are the variables and G their update functions, respectively, with each solver denoted by the subscripts “hy” for hydrodynamics, “rt” for radiation transport, and “sp” for spacetime. The variables V are not necessarily the evolved variables, e.g., in the non-relativistic hydrodynamics solvers in Flash-X, only the primitive fluid variables are tracked, and the update functions are assumed to provide the updated primitive variables at the new time-step. While this operator-split 118 method has worked well for non-relativistic problems and solvers that are not tightly-coupled together, the mixed time-levels have led to numerical instabilities when applied to coupled hydrodynamics and spacetime solvers in an earlier version of FLASH (Pajkos, 2022). As an alternative to the operator-split method, the new method-of-lines (MoL) time- integrator instead assumes the combined system of all solvers’ evolution equations takes the form ∂tU = Fhy(t, U) + F rt(t, U) + F sp(t, U) + . . . , (6.2) where U represents the combined evolved variables from all solvers, and the terms repre- F sent the right-hand sides (RHSs) of the evolution equations for each solver (as denoted by their subscripts). The MoL time-integrator provides separate explicit Runge-Kutta (ERK), implicit-explicit (IMEX), and multi-rate (MR) methods for discretizing Eq. (6.2). This section will present each of these methods as used in the MoL time-integrator. All methods will describe a multi-stage process for updating the evolved variables Un at a time tn to their values Un+1 at a time tn+1 = tn + ∆t, where ∆t is the size of the time-step. 6.1.1 Explicit Runge-Kutta Explicit time-integration methods compute intermediate and final states exclusively in terms of the current known state of the evolved variables. The time-integrator uses multi-stage methods based on the Runge-Kutta (RK) method (Runge, 1895; Kutta, 1901) described by a Butcher tableau (Butcher, 1963) cE AE , bE 119 (6.3) where the superscript “E” denotes these are for explicit methods, the matrix AE with ele- ments aE ij provides the weights for determining the intermediate stage updates, the column- vector cE with elements cE i = j aE ij determines the offset between times tn and tn+1 that the intermediate states represent, and the row-vector bE with elements bE (cid:80) j provides the weights for the final linear combination of the intermediate updates to integrate the evolved variables through the full time-step. For explicit methods, the matrix AE will be strictly lower-triangular; each row i represents an intermediate state, so only currently known in- termediate states with j < i can be used in the update. For an arbitrary s-stage explicit method, these linear combinations are ¯Ui = Un + ∆t Un+1 = ¯Un + ∆t 1 i − (cid:88)j=1 s (cid:88)j=1 E aE ijF tn + cE j ∆t, ¯Uj , (cid:16) tn + cE j ∆t, ¯Uj (6.4) (cid:17) , (cid:17) E bE j F (cid:16) where ¯U i represents the i-th intermediate state of the evolved variables, and E represents F the combined evaluation of all RHS terms of all evolution equations. The ERK time-integrator works with all explicit methods that take this form. New methods can be added simply by providing a Butcher tableau. See appendix G.1 for more information on the currently available methods in Flash-X. 6.1.2 Implicit-Explicit Methods Explicit integration methods are not always suitable for every problem. If the evolution equations contain terms with disparate timescales, choosing a practical time-step size that allows for stable explicit integration may not be possible. The terms that have the smallest 120 timescales, possibly orders of magnitude smaller than the other terms, are referred to as stiff, and typically must be integrated implicitly. For example, the discretized neutrino moment evolution equations have an advective timescale of (∆x/c) and an interaction timescale of O (1/cκ), where the speed of light c has been included explicitly; the interaction timescale O can be many orders of magnitude smaller than the advective timescale in optically thick regions when the opacity becomes large. Implicit time-integration can be computationally expensive, particularly when applied to partial differential equations that contain spatial derivatives of the evolved variables. A more efficient approach is the use of mixed implicit- explicit (IMEX) methods that couple an implicit method applied to the stiff terms with an explicit method applied to the non-stiff terms. The IMEX time-integrator makes use of the methods presented in Ascher et al. (1997) and Pareschi & Russo (2005). These methods will use a set of Butcher tableaus of the form cI AI cE AE , bI , bE (6.5) where the superscript “I” denotes the quantities specific to the implicit tableau, and the ma- trix and vector quantities represent the same stage-specific weights and offsets as their ERK counterparts. For these IMEX methods, the implicit methods will be limited to diagonally implicit methods, i.e., the matrix AI is lower-triangular with aI ij = 0 for j > i. The MoL form of the evolution equations is separated into non-stiff explicitly integrated terms and stiff implicitly integrated terms ∂tU = F E(t, U) + I(t, U), F (6.6) 121 where F I represented the combined evaluation of stiff source terms. The linear combinations for the intermediate stage and final updates are ¯Ui = Un + ∆t 1 i − (cid:88)j=1 s E aE ijF (cid:16) tn + cE j ∆t, ¯Uj + ∆t (cid:17) i (cid:88)j=1 I aI ijF j∆t, ¯Uj tn + cI (cid:16) , (cid:17) (6.7) Un+1 = ¯Un + ∆t E bE j F (cid:16) tn + cE j ∆t, ¯Uj + bI jF (cid:17) I tn + cI j∆t, ¯Uj (cid:16) .   (cid:17)  (cid:88)j=1  Each stage will require an implicit update when aI ii ̸ = 0. Currently, the only stiff terms in the combined evolution equations are the neutrino-matter interaction terms, so responsibility of the implicit update is delegated to the neutrino radiation transport solver to exploit the structure of the update equations presented in chapter 3. The IMEX time-integrator works with all methods that take this form. Similarly to the ERK methods, new IMEX methods can be added simply by providing a Butcher tableau. See appendix G.2 for more information on the currently available methods in Flash-X. 6.1.3 Multi-Rate Methods Some problem may have evolution equations that contain terms with faster timescales than the non-stiff explicitly integrated terms, but slower timescales than the stiff terms. In these situations, these semi-stiff terms may not be ideal for implicit methods. Additionally, a subset of the evolution equations may require a higher-order time-integration method or smaller time-step size to maintain numerical stability, but evolving the remaining equations with the same method or time-step might be too computationally expensive to be practical. For these situations, a multi-rate (MR) method that operates on slower and faster timescales separately with explicit or IMEX methods can be an ideal solution. 122 The MR time-integrator is based on the implicit-explicit multi-rate methods presented in Chinomona & Reynolds (2021). In this method, the evolution equations take the form ∂tU = F E(t, U) + I(t, U) + F(t, U), F F (6.8) where the superscript “F” denotes terms that will be integrated at the faster timescale; the implicit (I) and explicit (E) terms will be integrated at the slower timescale. The faster timescale method will evolve a modified evolution equation at each of the slower timescale method’s stages V′(θ) = F F(θ, V(θ)) + (θ), H (6.9) where θ is a new time-coordinate specific to the fast integration method, V represents the variables evolved by the fast method as a function of θ (this is not the same as the similarly named vector in the operator-split method earlier in this chapter) with the prime indicating the derivative with respect to θ, and H (θ) represents the contribution of terms from the slow integration method. This term intentionally does not include a dependence on U to emphasize that only θ changes in its evaluation, as it typically interpolates the results from the slow method in time. The slow IMEX methods will use a Butcher tableau of the form cS AI, k { k } 0{ } AE, { k k } 0{ } 1 bI,k 0{ k k } bE, { } k 0{ } , bI, k { } 0{ k k } bE, { } k 0{ } (6.10) where the superscript “S” denotes quantities specific to the slow integration method, the 123 additional row with the b vectors provide a stiffly-accurate form, and the superscripts k { } denote a set of 0 k ≤ ≤ kmax tableaus that are used in time-interpolation of the slow- method’s intermediate states. For an s-stage IMEX method used for the slower timescale integration, its tableau will be extended to 2s 2s to utilize the solve-decoupled method pro- × posed in Chinomona & Reynolds (2021), which alternates between “slow” and “fast” stages. Slow-stage updates are performed in the same manner as the IMEX method’s in Eq. (6.7), and fast-stage updates, which are currently limited to explicit methods, are performed the same as in the ERK method’s update in Eq. (6.4), but applied to Eq. (6.9) written in the form for the i-th slow integration stage V′(θ) = ∆cS F i F (cid:16) kmax 1 − i (θ) = H (cid:88)j=1 i (cid:88)k=0 kmax + tn + cS i − 1∆t + ∆cS k a k { E, ij } θ ∆t (cid:18) F (cid:19) (cid:16) k a I, k { ij } θ ∆t i θ, V(θ) + (θ) H E tn + cS (cid:17) j ∆t, ¯Uj (cid:17) (cid:88)j=1 (cid:88)k=0 V(0) = ¯Ui − (cid:18) 1, I F (cid:19) tn + cS (cid:16) ¯Ui = V(θ), j ∆t, ¯Uj (6.11) (cid:17) ∆cS i = cS i − cS i − 1, 0 θ ≤ ≤ ∆t. The IMEX tableau used for the slow stages takes the form AE = kmax (cid:88)k=0 1 k + 1 AE, k { }, AI = kmax (cid:88)k=0 1 k + 1 k AI, { }. (6.12) The MR time-integrator works with all methods that take this form. Currently, only a third-order method is available for the slow timescale integration (see appendix G.3), but all ERK methods in appendix G.1 are available for the fast timescale integration. 124 6.2 GRM1 The Flash-X radiation transport physics module GRM1 implements the neutrino moment evolution equations and numerical methods presented in chapter 3. This module implements the public interface, i.e., the parts accessible to other parts of Flash-X, of the radiation transport module, including initialization, calculation of implicit and explicit RHS terms, implicit updates of the interaction terms, and all pre- and post-time-step synchronization procedures. Following the design principles stated earlier in the chapter, all terms in the evolution equation, Eq. (3.102), are implemented as compact kernels operating on a single cell or local stencil of data, which are then used in procedures operating on a single block or row of data in the grid. The implementation of the public interface serves as the entry point and runtime controls that interact with Flash-X for tasks such as accessing the grid and its iterators, and performing I/O-related operations. The remainder of this section will provide a comprehensive set of test problems used to validate the implementation of the GRM1 solver. For simplicity, these test problems will all use the uniform grid provided by the Flash-X UG grid module. All test problems will make use of the third-order IMEX-ARK(3,4,3) time-integrator (see appendix G.2). As is standard practice for numerically evolving hyperbolic equations, the time-steps will be limited by the Courant-Friedrichs-Lewy (CFL) number to provide numerical stability (Toro, 2009) ∆t = Ccfl min i (cid:32) ∆xi λ | (cid:33) | . (6.13) Frequently, λ | | = c when there are regions where neutrinos are free streaming. One- and two- dimensional simulations use Ccfl = 0.5 while three-dimension simulations will use Ccfl = 0.3. Unless necessary for a particular test, only a single neutrino species and frequency will be 125 used. All test problems will also make use of the finite-volume discretization with a layer of two guard-cells unless stated otherwise. 6.2.1 Radiation Beam These tests utilize fixed-source radiation beams in vacuum to isolate and test the treatment of the spatial advection terms. Three-dimensional simulations are performed for both flat and curved spacetimes. These tests all verify the solver’s free-streaming advection capabilities, and produce results that compare favorably with similar tests performed in Foucart et al. (2015); Weih et al. (2020); Radice et al. (2022). 6.2.1.1 Flat Spacetime This set of tests uses a static Minkowski background metric in a Cartesian coordinate ba- sis. Separate simulations for on- and off-axis beam configurations test the free-streaming capabilities of the solver. Each configuration will also be used to compare the less- and more-dissipative forms of the generalized minmod limiter. All simulations use a grid dis- cretized into cells of size ∆x = ∆y = ∆z = 0.05, with outflow boundary conditions set at the extents of the domain. The on-axis beam configuration sets a fixed-source beam directed along the x-axis in the region x ≤ 0.1 and 0.05 y, z ≤ ≤ 0.15. The energy and momentum densities in the beam region are set to E = 1 and F i = (E, 0, 0), respectively. The simulations are initialized to E = F i = 0 outside of this region, and then evolved until a time t = 0.4. This configuration is ran separately for the θ = 1, 2 limits of the generalized minmod limiter. The comparison of the results for this test are displayed in fig. 6.1. In both sets of results, the beams maintain their shape and direction, and propagate at the expected speed (in units of c = 1). There 126 Figure 6.1: Fixed-source radiation beam (gray-shaded region) directed along the x-axis. Results for the normalized energy density are shown in the xy-plane at a time t = 0.4. The results for the more-dissipative θ = 1 and less-dissipative θ = 2 limiters are displayed in the upper and lower halves, respectively, with the black-dashed line separating the regions. is a slight broadening along the leading edge of the beam, with the more-dissipative limiter exhibiting the most broadening. The off-axis beam configuration translates the on-axis configuration’s fixed source to x = 0.1 and rotates it by 45◦ in the xy-plane to lie along the line x = y. Again, the simulations are initialized to E = F i = 0 outside of this region, and then evolved until a time t = 0.3. The comparison of the results for this test ran for the limiter’s θ = 1, 2 cases are displayed in fig. 6.2. In both sets of results, the beams maintain their expected direction and speed. However, the broadening previously limited to the leading edge of the beam in the on-axis configuration now extends to all sides. This effect is again more pronounced with 127 0.00.20.40.60.81.0x0.000.050.100.150.20yθ=1θ=20.00.51.0E/Emax Figure 6.2: Fixed-source radiation beam (gray-shaded region) directed along the line x = y. Results for the normalized energy density are shown in the xy-plane at a time t = 0.3. The results for the more-dissipative θ = 1 and the less-dissipative θ = 2 limiters are displayed in the upper left and lower-right, respectively, with the black-dashed line separating the regions. the more-dissipative θ = 1 limiter. 6.2.1.2 Schwarzschild Spacetime The second set of radiation beam tests examine the GRM1 solver’s treatment of advection in a curved spacetime. For this purpose, a Schwarzschild black hole with a mass M = 1 is placed at the origin, and described by a Kerr-Schild Cartesian coordinate basis. This choice of basis produces both a non-unit lapse and metric components, as well as a non- zero shift and extrinsic curvature components; this proves useful in verifying the correct implementation of terms containing these quantities in the evolution equations. In Kerr- 128 0.00.10.20.30.40.5x0.00.10.20.30.40.5yθ=1θ=20.00.51.0E/Emax r ≤ Figure 6.3: Fixed-source radiation beam (gray-shaded region) located between a radius of 8 along the y-axis outside of a unit mass Schwarzschild black hole. The beam 7 is oriented in the positive x-direction, and evolved until a time t = 15. The results show the normalized energy density compared to the bounding null geodesics (solid black lines) indicating the expected path of the beam. ≤ Schild Cartesian coordinates, the Schwarzschild lapse, shift, spatial metric, and extrinsic curvature are (Baumgarte & Shapiro, 2010) 2M r 1 2 − (cid:19) , γij = ηij + 2M r ℓiℓj α = 1 + βi = (cid:18) 2M α2 r ℓi, Kij = r2 = x2 + y2 + z2, 2M α r ηij − (cid:20) ℓi = ℓi = M r ℓiℓj (cid:19) (cid:21) 2 + (cid:18) xi r , (6.14) where ηij = diag(1, 1, 1) is Minkowski metric in Cartesian coordinates. While three-dimensional simulations are used for these tests, they are confined to the 129 02468x456789y0.00.51.0E/Emax r ≤ Figure 6.4: Fixed-source radiation beam (gray-shaded region) located between a radius of 4 along the y-axis outside of a unit mass Schwarzschild black hole. The beam 3 is oriented in the positive x-direction, and evolved until a time t = 15. The results show the normalized energy density compared to the bounding null geodesics (solid black lines) indicating the expected path of the beam. ≤ region of x, y ≥ 0 and a single-layer of cells straddling z = 0. The domain is discretized into cells of size ∆x = ∆y = ∆z = 0.1. Fixed source beams are added along the y-axis and oriented such that αF j − βj is parallel to the x-axis. Two separate beam locations are used, one located at 7 y ≤ ≤ 8 and one located closer to the black hole at 3 y ≤ ≤ 4. Both simulations set the beam’s fixed-source to an energy density of E = 1 and the magnitude of the momentum density to γij F iF j = E2. Outflow boundaries are used for the radiation quantities, while the metric quantities are set to their analytic values at the boundaries. Each simulation is then evolved until a time t = 15, allowing the beam to propagate through the computational domain. 130 012345x012345y0.00.51.0E/Emax The results for the far and near beam simulations are displayed in figs. 6.3–6.4. In each figure, the beams are compared to the null geodesics emanating from boundaries of the fixed-source of each beam. In both cases, the beams closely follow these expected trajectories curving around the black hole. The beams diffuse slightly outside of these bounds due to the numerical treatment of the fluxes, e.g., cells that straddle the bounding geodesics allow for transport of energy outside of this region. These type of numerical artifacts are present in similar tests performed in Foucart et al. (2015); Radice et al. (2022). 6.2.2 Radiating Sphere A radiating homogeneous sphere is used to examine the GRM1 solver’s ability to transition between the optically thin and thick regimes. A uniform density sphere with a radius R is placed at the origin and assigned a constant equilibrium energy density, Jeq, and absorption opacity, κabs., and evolved until reaching a steady-state. This test problem proves useful in examining the validity of the M1 closure by comparison to the analytic steady-state solution presented in Smit et al. (1997) f (r, µ) = Jeq. 1 (cid:104) κabs.s(r,µ) e− − , (cid:105) Rg(r, µ) + rµ, 2Rg(r, µ), r < R and R and r ≥ 1 < µ < 1 − 1 (cid:114) − 2 R r (cid:16) (cid:17) , (6.15) < µ < 1 s(r, µ) =    1 (cid:114) g(r, µ) = r R − (cid:16) 2 (cid:17) (cid:16) 1 − µ2 , (cid:17) where µ = cos θ. The first few projected co-moving frame moments can then be obtained directly by using the distribution function in Eq. (6.15) in Eqns. (3.17)–(3.19). Two separate simulations are performed for optically thin and thick spheres. For the 131 Figure 6.5: Results for the optically thin radiating sphere (Jeq. = 0.8 and κabs. = 4) at a time t = 5. The numerical (red solid lines) and analytic (black dotted lines) solutions for the energy density, momentum density, and pressure are compared. optically thin sphere, the equilibrium energy density and absorption opacity are set to the values used in Smit et al. (1997), Jeq. = 0.8 and κabs. = 4. For the optically thick sphere, 132 0.00.20.40.60.8ENumericalAnalytic0.00.20.40.60.81.0Fr/E0.00.51.01.52.02.53.0r0.40.60.81.0Prr/E Figure 6.6: Results for the optically thick radiating sphere (Jeq. = 10 and κabs. = 250) at a time t = 5. The numerical (red solid lines) and analytic (black dotted lines) solutions for the energy density, momentum density, and pressure are compared. these values are set to the ones used in Abdikamalov et al. (2012), Jeq. = 10 and κabs. = 250. Both simulations place a sphere with a radius R = 1 at the origin on a one-dimensional 133 0246810ENumericalAnalytic0.00.20.40.60.81.0Fr/E0.00.51.01.52.02.53.0r0.40.60.81.0Prr/E spherically symmetric domain that extends out to a radius of rmax = 3. The radial axis is discretized into 500 cells (for a cell-size of ∆r = 0.006), which ensures that the corrective factor in Eq. (3.129) is used in the optically thick case only. Each simulation initializes the energy density to a constant value inside the sphere with a subsequent 1/r2 drop-off outside E = Jeq. × R r ≤ r > R 1, 2 , R r (cid:16) (cid:17) , Fr = E ×       10− 10, 1 2 , R r ≤ . r > R (6.16) A reflective boundary condition is placed at r = 0, and an outflow boundary condition at r = 3. Each simulation is evolved past reaching a steady-state until a time t = 5. The results for the optically thin and thick simulations are shown in figs. 6.5–6.6. In each case, the solutions closely match their analytic values in the optically thin and thick limits, but deviate in the intermediate regime just outside of the sphere. These results are on par with similar tests performed with M1 radiation transport solvers in Foucart et al. (2015); O’Connor (2015); Weih et al. (2020); Radice et al. (2022); Cheong et al. (2023). The deviation of the results when not fully in the optically thin or thick limit is expected when using the Minerbo closure, Eq. (3.108), or other similar closure relations, as they are unable to produce the exact closure relation of the analytic solution (Murchikova et al., 2017). 6.2.3 Shadow Casting A series of shadow casting test problems are used as a further test of the GRM1 solver’s ability to transition between the optically thin and thick regimes. These tests will place a completely absorbing medium outside of a radiative source, and examine the occluded downstream region. M1 radiation transport solvers excel at capturing the shadows cast in 134 these regions, while more-approximate methods fail to resolve these features; see Hayes & Norman (2003) for a comparison of the ability of two-moment and flux-limited diffusion solvers to resolve shadows. The first test extends the previous on-axis radiation beam test to include a completely absorbing sphere placed downstream from the fixed-beam source. The fixed-source is con- fined to the region x 0.1 and 0.1 − ≤ y, z ≤ ≤ 0.1 and is directed along the x-axis, and its energy density is fixed at E = 1. A completely absorbing sphere with a radius 0.05 is placed downstream along the x-axis at x = 0.3; the sphere’s absorption opacity is set to κabs., while its emissivity is set to κabs.Jeq. = 0. The domain is discretized into cells of size ∆x = ∆y = ∆z = 0.005, and outflow boundary conditions are enforced along each boundary. The initial energy and momentum density are set to zero everywhere outside of the fixed-source beam. The simulation is evolved until a time t = 0.5, allowing the beam to pass the sphere and exit the domain. The results for this test are displayed in fig. 6.7 and show a crisp shadow downstream from absorbing sphere. The marginal broadening of the edges of the beam adjacent to the occluded region result from the approximation of the sphere in the rectilinear grid, as the reconstruction stencils used to approximate the flux overlap past the sphere into the upstream beam near the top and bottom edges. However, the beam does not diffuse any further into this region as it continues to propagate through the domain. A second test to assess the shadow-casting capabilities of the GRM1 solver utilizes a radiat- ing sphere as the radiative source. This test adopts a similar setup as the tests performed in O’Connor & Couch (2018a); Cheong et al. (2023). The radiating sphere source with radius R = 1.5 is placed at the origin, and assigned an equilibrium energy density of Jeq. = 1 and a radially varying absorption opacity κabs.(r) = 10 exp 135 (4r/R)2 . A completely absorbing (cid:3) − (cid:2) Figure 6.7: Results for the shadow cast by an absorbing sphere (black hatched region) placed in the path of a fixed-source beam (gray shaded region). The beam is evolved until a time t = 0.5 allowing it to fully pass by the sphere and exit the domain. A crisp shadow can be seen in the region downstream from the absorbing sphere. sphere with a radius of ¯R = 2 is placed outside of the sphere on the x-axis at x = 8; the absorbing sphere is again assigned an absorption opacity ¯κabs. = 106 and the emissivity is forced to zero. The domain is discretized into cells of size ∆x = ∆y = ∆z = 0.075, and outflow conditions are enforced at all boundaries. The simulation is evolved until a time t = 15, allowing the solution to reach a steady-state. Figure 6.8 displays the results for this test after the steady-state has been reached. As with the prior test using the fixed-source beam in propagating in a uniform direction, the absorbing sphere correctly produces a shadow in the downstream region. Again, some broad- ening along the boundary between the free-streaming and occluded regions is present, but 136 0.00.10.20.30.40.5x−0.2−0.10.00.10.2y0.00.51.0E/Emax Figure 6.8: Results at the time t = 15 for the shadow cast by an absorbing sphere (black hatched region) placed outside of a radiating sphere located at the origin. A crisp shadow forms in the region occluded by the absorbing sphere and persists in the steady-state solution. the radiation’s propagation direction is maintained. These results agree with those of the similar tests performed in O’Connor & Couch (2018a); Cheong et al. (2023), and further validate the GRM1 solver’s treatment of advection and interactions. 6.2.4 Diffusion Limit In the optically thick limit radiation behaves diffusively in the co-moving frame of the fluid. Since the radiation is fully trapped by the fluid in this limit, any advection observed in the Eulerian frame is the result of the motion of the fluid. A series of diffusion problems are used to assess both the corrections made to the hyperbolic fluxes in this limit and the retention of all non-linear source terms during the implicit update of the neutrino-matter interactions. 137 246810x−4−2024y0.00.51.0r2E/(cid:0)r2E(cid:1)max All diffusion tests will be performed in strictly-scattering media and a static Minkowski background spacetime. Under these conditions, the evolution of the radiation’s energy den- sity can be described by a diffusion equation (Pons et al., 2000; Radice et al., 2022; Cheong et al., 2023), which can be written in the form ∂tE = τd∇ 2E, (6.17) where τd = 1/3κ is the diffusion timescale. Since these problems will exclusively use purely- scattering media, the opacity in the diffusion timescale will always be taken as the scattering opacity, κ ≡ κiso. For verification purposes, each test will correspond to a problem that permits an analytic solution of Eq. (6.17). Cases for stationary and moving media will be considered separately in this section; a second stationary medium will later be used for testing spatial convergence rates. 6.2.4.1 Stationary Medium A stationary medium is used to validate the correction of the hyperbolic fluxes in the asymp- totically optically thick limit. This test will use a point-like source as proposed in Pons et al. (2000) to produce steep gradients in the energy density;this would lead to incorrect numer- ical fluxes without the corrective factor in Eq. (3.129) being applied to the Riemann solver in Eq. (3.127). By assuming an initial point-like source at the origin for the energy density that is proportional to a δ-function E(⃗r, t = 0) = δ3(⃗r), (6.18) 138 where ⃗r is the coordinate position vector, Eq. (6.17) can be solved in a spherically symmetric spacetime via a Fourier transform to yield the analytic solution E(r, t) = 1 3τdt (cid:19) (cid:18) 3 2 exp r2 4τdt . (cid:19) − (cid:18) (6.19) Pons et al. (2000) shows that the momentum density in the optically thick limit is then F r(r, t) = τd∂r E(r, t) = − r 2t E(r, t). (6.20) Two tests at different scattering opacities κ = 102 and κ = 104 are conducted. Each test is initialized at a time t > 0 from the analytic solution in Eqns. (6.19)–(6.20). One- dimensional spherically symmetric domains are discretized into cells of size ∆r = 0.01; this guarantees that the optical depth for the κ = 102 case remains at τ = 1 and that the fluxes are not corrected for the optically thick limit, while the case for κ = 104 has an optical depth of τ = 102, and the corrections are applied. Reflective boundary conditions are applied at the origin, and outflow conditions are enforced at the outer boundary. The results of each test are displayed in figs. 6.9–6.10. The numerical results closely follow the analytic solution in both cases, verifying that the optically thick correction to the hyperbolic fluxes works properly. These tests are in agreement with the results of similar tests performed in Pons et al. (2000); O’Connor (2015); Cheong et al. (2023). 6.2.4.2 Moving Medium A moving medium is used to test the retention of the non-linear interaction source terms in the implicit update. These terms are most impactful in the optically thick limit, and 139 Figure 6.9: Results for the point-like source in a scattering medium with κ = 102. The numerical (solid lines) and analytic (dotted lines) solutions are compared at various times. become highly non-linear when the fluid velocity is non-zero. Failure to retain the non-linear terms or the use of O (v/c) approximations can lead to violation of energy conservation and 140 0.000.050.100.150.200.250.300.350.40r050100150200250300350Et=2t=3t=4t=50.000.050.100.150.200.250.300.350.40r0123456Fκs=102NumericalAnalytic Figure 6.10: Results for the point-like source in a scattering medium with κ = 104. The numerical (solid lines) and analytic (dotted lines) solutions are compared at various times. incorrect advective speeds (Radia et al., 2022). This test will follow a similar setup as the one used in Radice et al. (2022); Cheong et al. (2023). 141 0.000.050.100.150.200.250.300.350.40r050100150200250300350Et=200t=300t=400t=5000.000.050.100.150.200.250.300.350.40r0.000.010.020.030.040.050.06Fκs=104NumericalAnalytic Figure 6.11: Results for a radiation pulse in a moving scattering medium. The numerical result (red solid line) closely matched the expected result (black dotted line). No common issues associated with incorrect treatment of the non-linear interactions terms are present in the solution. A radiation pulse will be set in a background scattering medium moving with a velocity v in a one-dimensional Minkowski spacetime. The initial pulse is placed at the origin with the shape E(x, 0) = exp 9x2 . (cid:17) − (cid:16) (6.21) Solving Eq. (6.17) with this initial condition and advecting the resulting solution at a con- stant velocity v yields the expected solution for the time-evolution of the energy density E(x, t) = 1 √1 + 36τdt exp vt)2 9(x − 1 + 36τdt (cid:35) . (cid:34)− (6.22) 142 0.00.51.01.52.02.53.03.5x0.00.20.40.60.81.0ENumericalAnalytic The domain spans − 5 < x < 5 and the x-axis is discretized into 1024 cells. The background medium is assigned a scattering opacity κ = 103 and a velocity along the x-axis of v = 0.5. The results at a time t = 4 are displayed in fig. 6.11. The potential issues associated with an incorrect treatment of the non-linear source terms are not present in the solution, verifying that their implementation in the GRM1 solver works correctly. These results are in agreement with the tests performed with similar treatments of these terms in Radice et al. (2022); Cheong et al. (2023). 6.2.5 Advection Through Velocity Jump For highly-relativistic problems, the GRM1 solver will need to be able to handle large velocities and gradients. A beam of radiation is evolved through a velocity jump to test these limits. This test will be restricted to a completely optically thin background to isolate and verify the velocity-dependence in solving the closure in the co-moving frame. For this test, a one-dimensional Minkowski spacetime spanning 1 < x < 1 will be − discretized into 512 cells. Simple outflow conditions will be imposed at the boundaries. The background optically thin medium is assigned a velocity 0.9, x < 0 , 0.9, x > 0 − (6.23) vx =    for a relative Lorentz factor W ≈ as E = F x = 1 in the region x < 10 across the jump located at x = 0. The beam is initialized 0.5 and zero elsewhere. Separate simulations will use the − more-dissipative (θ = 1) and less-dissipative (θ = 2) limiters. Both simulations demonstrate the GRM1 solver’s ability to advect the radiation beam 143 Figure 6.12: Propagation of a radiation beam through a relativistic velocity jump. Velocities are fixed at vx = 0.9 for x < 0, and vx = 0.9 for x > 0. The numerical solutions for − the more-dissipative (purple dashed line) and less-dissipative (blue dotted line) limiters are compared with the expected solution (black solid line). through the velocity jump; see fig. 6.12 for the results. There are no spurious oscillations observed at the velocity jump, and the beam maintains its expected speed. As with the previous beam tests, the less-dissipative limiter better resolves the leading edge of the beam. These results compare favorably with the similar tests performed in Radice et al. (2022); Cheong et al. (2023). 6.2.6 Velocity- and Curvature-Dependent Redshifting The frequency advection terms couple the evolution equations for each frequency when the fluid is accelerating or the spacetime is not flat. To demonstrate the effectiveness of the 144 −0.50.00.5x0.000.250.500.751.00Evx=0.9vx=−0.9Expectedθ=1.0θ=2.0 pseudospectral discretization of the frequency advection operator, the co-moving frame lu- minosity of an optically thick radiating sphere will be measured. Three cases will be con- sidered: a finite-velocity profile located far outside a zero-mass sphere, a massive sphere and zero-velocity everywhere, and the mixed case of the massive sphere and finite-velocity profile. These tests will utilize setups similar to those described in M¨uller et al. (2010); O’Connor (2015); Cheong et al. (2023). In a spherically symmetric spacetime, the luminosity measured by a co-moving observer is simply the total energy flux passing through a spherical surface at a radius r. In the optically thin limit, this takes the form ∞ dν ˜Hr (ν) = W α vr 1 − 1 + vr (r) L ∝ 0 (cid:90) α (cid:20) 0 (cid:90) ∞ dν ˜F r (ν) . (cid:21) (6.24) The steady-state limit of the frequency-integrated evolution equation for the energy density, Eq. (3.44), in the optically thin limit shows that the final bracketed quantity in Eq. (6.24) is ∞ dν ˜F r (ν) = const. α 0 (cid:90) (6.25) everywhere outside of the sphere. The term in the brackets can thus be evaluated at a point outside of the sphere, and scaled by W α− 1(1 − vr)/(1 + vr) to determine the expected co-moving frame luminosity. For all tests, a radiating sphere of radius R = 8 is placed at the origin and assigned an absorption opacity κabs. = 100. The frequencies are discretized around a T = 5 equilibrium Fermi-Dirac distribution using five frequency collocation points; the equilibrium energy den- sity and emissivity for each frequency are also set from this distribution. A one-dimensional 145 Figure 6.13: Luminosity measured in the co-moving frame for the finite-velocity case (top plot). The numerical results (red solid line) are compared to the expected results (black dashed line). The velocity profile (middle plot) and lapse (bottom plot) are shown for reference. spherically symmetric domain spans 0 r ≤ ≤ 800 and is discretized into 4096 radial cells. A reflective boundary is used at the origin, while an outflow condition is imposed at the outer boundary. For cases with a non-zero velocity, the velocity profile is set to 0, r < 90 , 90 r ≤ ≤ 100 . (6.26) vr = 0.2 − 0.2 − (cid:18) (cid:18) r 90 − 10 100 r (cid:19) (cid:19) 2 ,    r > 100 For cases with a sphere of mass M = 1.8, the constant-density solution of the Tolman- Oppenheimer-Volkoff (TOV) equations is used (see Wald (1984) for the derivation). In a 146 0.81.01.21.41.6L(r)/L∞numericalexpected−0.250.000.25vr101102r0.751.001.25α Figure 6.14: Luminosity measured in the co-moving frame for the finite-mass case (top plot). The numerical results (red solid line) are compared to the expected results (black dashed line). The velocity profile (middle plot) and lapse (bottom plot) are shown for reference. TOV spacetime, a self-gravitating sphere of constant density has an enclosed mass at an interior point m(r) = M (r/R)3. This leads to the spacetime quantities that differ from a spherical Minkowski spacetime 2M r , 3 1 2 (cid:114) − − 1 (cid:114) α =    γrr =  (cid:18)  (cid:18)  2M R − 1 1 2(cid:115) − 2M r2 R3 , R r ≤ , r > r 1 − 1 1 − − 2M r2 R3 2M r (cid:19) (cid:19) 1 − , r R ≤ . , r > R (6.27) (6.28) Each simulation was evolved until a time t = 1000. An initial set of tests using the 147 0.81.01.21.41.6L(r)/L∞numericalexpected−0.250.000.25vr101102r0.751.001.25α Figure 6.15: Luminosity measured in the co-moving frame for the combined finite-velocity and finite-mass case (top plot). The numerical results (red solid line) are compared to the expected results (black dashed line). The velocity profile (middle plot) and lapse (top plot) are shown for reference. finite-volume discretization successfully performed in the finite-velocity and finite-mass only cases, but struggled with the mixed case; oscillations formed near the discontinuities in the velocity’s gradient, but remained as a steady-state solution. This prompted the addition of the finite-difference discretization, which was able to successfully evolve all three cases to their expected steady-state solution. These results are displayed in figs. 6.13–6.15. In each case, the numerical solution closely follows the expected results. Some slight noise is present in the region preceding the velocity profile in the finite-velocity case, but this is not unexpected with the fairly coarse discretization used in these tests. Overall, these results represent a successful test of the redshifting discretization. The results obtained here with only five neutrino frequencies compare favorably with the similar 148 0.81.01.21.41.6L(r)/L∞numericalexpected−0.250.000.25vr101102r0.751.001.25α tests performed in O’Connor (2015); Cheong et al. (2023) using a frequency-bin method uti- lizing 18 neutrino frequencies. Further testing of this discretization is necessary to determine how effective and accurate it is when the underlying distribution of the neutrinos deviates far from the equilibrium distribution it has been discretized around. 6.2.7 Spatial Convergence To verify the expected second-order spatial convergence of the GRM1 solver, the optically thin and thick cases are tested separately for problems that have analytic solutions E(x, t) for the energy density. These will be used to quantify the numerical error in solution at the N -th time step in the i-th cell by the residual δEN i = EN i − E(xi, tN ). From these residuals, the discrete L2-norm can be computed over the grid (LeVeque, 2002) δEN (cid:13) (cid:13) (cid:13) 2 (cid:13) (cid:13) (cid:13) = ∆x (cid:115) (cid:88)i (cid:0) EN i − E(xi, tN ) 2 . (cid:1) (6.29) The spatial-convergence rate can easily be obtained from the slope of the best-fit line (in log-log space) of the residual as a function of the grid resolution. 6.2.7.1 Optically Thin Limit For the optically thin limit, a radiation pulse is evolved in an optically thin Bondi flow outside of a Schwarzschild black hole. The analytic outgoing wavelike solution from Shibata et al. (2011) will be used to compare the numerical results against. In Kerr-Schild spherical coordinates, the outgoing solution takes the form E(r, t) = F r(r, t) = g+(r∗ − − t) 2M/r)2 , 2√γα3(1 (6.30) 149 Figure 6.16: Initial (purple solid line) and final (blue solid line) states for a radiation pulse in an optically thin Bondi flow from the highest resolution (k = 13) case. The extracted shapes of the wave pulses are extracted via Eq. (6.33) and compared to the analytic results (black dashed lines). where M is the mass of the black hole, and g+(r∗ − a time t with r∗ defined as t) is the shape of the radiation pulse at r∗ = dr (cid:90) r + 2M 2M r − = r + 4M log r 2M − M . (cid:21) (cid:20) (6.31) A similar setup to the numerical simulations in Shibata et al. (2011) is used, and the shape of the pulse is set to g+(r∗ − t) = exp r∗ − t − 8M 2 r∗0 2 . (cid:1) (cid:35) (cid:34)−(cid:0) (6.32) 150 0510152025303540r0.00.20.40.60.81.0E+t=0t=35 Figure 6.17: Spatial convergence rate for a radiation pulse in an optically thin Bondi flow. The numerical results (red line) meet the expected second-order convergence rate (black dashed line for reference). The radial axis of a spherically symmetric domain is discretized into 2k cells, for k [9, 13]. ∈ The simulations are evolved until a final time tN = 35. The shape of the pulse is extracted from the numerical results as E+ = 2√γα3 2M r 1 (cid:18) − 2 E. (cid:19) (6.33) The results for the shape of the pulse at the initial and final times for the highest resolu- tion case k = 13 are shown in fig. 6.16, while fig. 6.17 displays the L2-norm of the residuals across all resolutions. The spatial convergence rate for these results is 2.08 0.03, demon- ± strating the expected second-order accuracy of the spatial discretization in the optically thin limit. 151 10−210−1∆r10−410−310−2||EN||2Convergencerate:2.08±0.03NumericalSecond-order 6.2.7.2 Optically Thick Limit The spatial convergence rate in the optically thick limit is tested by evolving a radiation pulse in a purely scattering stationary medium. For this test, the initial pulse is set to a unit box centered at the origin 1, 2 < x < 1 1 2 − . 0, otherwise E(x, t = 0) =    Solving Eq. (6.17) with this initial condition gives the analytic result E(x, t) = 1 2(cid:34) erf x + 1 2 √4τdt (cid:33) − (cid:32) erf 1 x 2 √4τdt(cid:33)(cid:35) − . (cid:32) (6.34) (6.35) Figure 6.18: Numerical (red solid line) and analytic (black dotted line) results of a radiation pulse in an optically thick scattering medium for the k = 10 case. 152 0.00.20.40.60.81.0x0.00.20.40.60.81.0ENumericalAnalytic Figure 6.19: Spatial convergence rate for a radiation pulse in an optically thick scattering medium. The numerical results (red line) approach the expected second-order convergence rate (black dashed line for reference). The background scattering opacity is set to κiso = 103 everywhere in the domain. The domain spans − 2 < x < 2 and is discretized into 2k cells, where k [7, 11] for separate ∈ simulations. Each simulation is evolved until a time t = 10. The results for the k = 10 resolution are displayed in fig. 6.18 and show good agreement with the analytic solution. The convergence rate found across all resolutions was found to be 1.77 ± 0.02, almost reaching the expected second-order rate; see fig. 6.19 for the results. These results are acceptable for the discontinuous initial data; the combination of the HLL Riemann solver and the generalized minmod limiter are only expected to be second-order accurate in smooth regions of the solution. 153 10−210−1∆x10−410−310−2||EN||2Convergencerate:1.77±0.02NumericalSecond-Order 6.3 GRFD The GRFD solver provides a general relativistic implementation of the Flash-X hydrody- namics physics module using the formalism and numerical methods presented in chapter 4. Similarly to the GRM1 solver, this solver implements the MoL-specific pieces of the module’s public interface, including calculation of the explicit RHS terms and pre- and post-update synchronization. This solver also encapsulates the calculations of the terms in the evolution equations in compact kernels, which are then applied to individual cells or local stencils in grid block- or row-level procedures. These procedures are organized and managed di- rectly within the public interface implementations that serve as the entry point and runtime controls for the solver. The goal of the GRFD solver is two-fold: provide an example solver that utilizes and tests the MoL ERK integrator, and provide general relativistic hydrodynamics to be used alongside the GRM1 solver. The latter goal is presently being worked towards. The remainder of this section will present a series of test problems that serve to verify the solver’s implementation and its use of the ERK integrator. All test problems will use the fourth-order ERK-RK4 time-integrator (see appendix G.1). Time-step sizes will again be limited by a CFL number as in Eq. (6.13). For one-dimensional simulations will use Ccfl = 0.5 and two-dimensional simulations will use Ccfl = 0.2. All simulations will use the symmetric fifth-order WENO reconstruction scheme described in chapter 4, and utilize a layer of four guard-cells. 6.3.1 Relativistic Shock Tube One of the standard test problems for hydrodynamics solvers is a shock tube setup. These types of problems set discontinuous left and right states for the fluid’s density, pressure, and 154 Figure 6.20: Results of the shock tube problem for a relativistic blast-wave and no transverse velocity. The initial discontinuity is located at x = 0.5. The numerical results (red dotted lines) capture the shock and closely follow the exact solution (black solid line). velocity. Depending on these initial states and their relative velocity, the system will develop into one of three patterns: two shocks, two rarefaction waves, or a shock and rarefaction wave. These are ideal tests to verify a solver’s ability to capture the shocks in the fluid. In relativistic hydrodynamics, the solutions for shock tube problems couple velocities in all directions via the Lorentz factor, and prove more challenging than non-relativistic solutions where only the velocity in the direction of the flow matters (Rezzolla et al., 2003). This test problem will use a relativistic blast-wave setup, and separately consider cases with and without an initial transverse velocity ahead of the shock to verify that the GRM1 solver can not only capture the shock, but also correctly include the full velocity-dependence in the 155 0.000.250.500.751.00x0.0000.0020.0040.0060.0080.010Rest-Mass DensityExactNumerical0.000.250.500.751.00x0.00.20.40.60.81.0Pressure0.000.250.500.751.00x050010001500Internal Energy0.000.250.500.751.00x0.00.20.40.60.81.0Velocity Figure 6.21: Results of the shock tube problem for a relativistic blast-wave with an initial transverse velocity v = 0.99 set in the region ahead of the shock. The initial discontinuity is located at x = 0.5. The numerical results (red dotted lines) capture the shock and closely follow the exact solution (black solid line). ⊥ solution. The initial left (L) and right (R) states will be set to ρL = 10− 3, pL = 1, vL = 0, ρR = 10− 3, pR = 10− 5, vR = 0, (6.36) (6.37) and an initial transverse velocity (relative to the direction the shock travels) is separately set to vR ⊥ = 0 and vR ⊥ = 0.99 ahead of the shock in each simulation, and zero behind the shock for both. The initial discontinuity is placed at x = 0.5. An ideal Γ-law equation of state is used with Γ = 5/3. The domain spans 0 < x < 1 and is discretized into 400 cells. Both simulations are then evolved until a time t = 0.4, allowing time for the shock and rarefaction 156 0.000.250.500.751.00x0.0000.0050.0100.0150.020Rest-Mass DensityvL=0.00vR=0.99ExactNumerical0.000.250.500.751.00x0.00.20.40.60.81.0Pressure0.000.250.500.751.00x050010001500Internal Energy0.000.250.500.751.00x0.00.20.40.60.8Velocity waves to clearly develop while still staying within the computational domain. The results for these shock tube problem are displayed in figs. 6.20–6.21. The exact so- lutions are calculated following the procedure described in Rezzolla et al. (2003); Rezzolla & Zanotti (2013). The rest-mass density, pressure, internal energy, and fluid velocity all follow the exact results closely. The solver resolves the leading shock and locations of the contact discontinuity and the tail/head of the rarefaction wave without any spurious oscillations or severe broadening in both cases, although the narrow region between the contact discontinu- ity and the shock in the case without transverse velocity requires a higher grid resolution to better capture the magnitude of the density. These results are all in agreement with similar tests presented in Radice & Rezzolla (2012); Rezzolla & Zanotti (2013). 6.3.2 Kelvin-Helmholtz Instability The next test verifies the GRFD solver’s multi-dimensional capabilities by examining the development of a Kelvin-Helmholtz instability in the presence of relativistic fluid velocities. These instabilities form vortices along the contact between fluids of different densities moving in different directions. The simulation used here will follow the one presented in Radice & Rezzolla (2012). A high- and low-density regions are placed in contact with each other and assigned opposing velocities, with a small initial perturbation in the transverse directions of the flow to prompt the formation of the instability. These regions are separated along the y-axis, and the flow direction is set along the x-axis using the initial values for the velocity V0 tanh V0 tanh − y 1 2 − d (cid:33) , y + 1 2 d (cid:33) , (cid:32) (cid:32) y > 0 , y 0 ≤ vx(y) =    157 (6.38) and vy(x, y) = A0V0 sin (2πx) exp  y −(cid:16) 1 2 − σ A0V0 sin (2πx) exp  − −(cid:16) σ (cid:17) y + 1 2     2 ,  (cid:17)   2 ,    y > 0 y 0 ≤ , (6.39)    where V0 is the magnitude of the initial opposing velocities, d is the distance over which the velocities change, and A0 and σ describe the amplitude and width of the initial perturbation, respectively. The initial values for the density are ρ(y) =  ρ0 + ρ1 tanh  ρ0 −  ρ1 tanh y 1 2 − d (cid:33) , y + 1 2 d (cid:33) , (cid:32) (cid:32) y > 0 , y 0 ≤ (6.40) where ρ0 and ρ1 are used to set the initial densities. The parameters are set to the values V0 = 0.5, d = 0.01, A0 = 0.1, σ = 0.1, ρ0 = 0.505, ρ1 = 0.495, (6.41) For this simulation, a two-dimensional domain spans 0.5 < x < 0.5 and − 1 < y < 1, and − is discretized into 256 × 512 grid cells. Periodic boundary conditions are used on all sides of the domain. An ideal Γ-law equation of state is used with Γ = 4/3. The simulation was ran until a time t = 3. The results shown in fig. 6.22 display the development of the primary vortices expected for this type of instability. The secondary vortices represent numerical artifacts that develop 158 Figure 6.22: Results for the Kelvin-Helmholtz instability problem. The higher-density upper- and lower- regions and middle-regions are given opposing velocities. The numerical results for the rest-mass density show the development of the primary and secondary vortices. differently for varying resolutions and different numerical treatments of the fluxes; these are commonly seen in simulations of Kelvin-Helmholtz instabilities (Radice & Rezzolla, 2012). The numerical results mirror each other across the line y = 0, maintaining the symmetry expected from the initial fluid state and periodic boundaries conditions. Overall, the GRFD solver handles the development of these Kelvin-Helmholtz instabilities very well, verifying its multi-dimensional capabilities. 6.3.3 Bondi-Hoyle Accretion The Bondi-Hoyle problem describes the accretion of an infinite gas cloud onto a moving star (Edgar, 2004). This problem provides an excellent test for the general relativistic capabilities 159 of the GRFD solver when applied to accretion onto a black hole. The alternative case of a constant wind accreting onto a stationary black hole will be considered, such that a constant analytic background spacetime can be used. This simulation will use an infinite wind with an initial density ρ0 = 1 and velocity v0 = 0.3 in the positive x-direction; the sound speed is chosen to be cs,0 = 0.1 such that the wind will be supersonic. An ideal Γ-law equation of state with Γ = 4/3 will be used to invert the density and sound-speed to find the initial pressure p0 = Γ ρ0c2 Γ s,0(Γ 1 − − 1) − c2 s,0 (cid:16) , (cid:17) (6.42) from which the remaining fluid variables can then be found. A unit mass Schwarzschild black hole is placed at the origin. The two-dimensional spherical domain in the azimuthal plane will be used, and described by spherical Kerr-Schild coordinates. The metric quan- tities will set the same as in Eq. (6.14), but with the replacement ℓi = (1, 0, 0) and ηij = diag 1, r2 sinθ, r2 . Note that the order of the coordinate basis is (r, ϕ, θ) instead of the (cid:16) (cid:17) typical (r, θ, ϕ) to ensure that these two directions are properly treated as the first and sec- ond dimensions during direction-dependent calculations in the two-dimensional simulation. In this coordinate system, the initial velocity components are then set as vr(r, ϕ) = v0 γrr cos ϕ, vϕ(r, ϕ) = − (cid:112) v0 γϕϕ sin ϕ, (cid:113) (6.43) such that the velocity points in the positive x-direction and γij vivj = v2 0; these velocity components will always take this form for any spherically symmetric spacetime even when using different coordinate bases so long as the metric is strictly diagonal. 160 The domain covers the full 2π azimuthal angle and extends out to a radius of rmax = 100. The minimum radius is instead chosen as rmin = 2.2 such that the inner boundary is located just outside the event horizon; this allows the simulation to disregard the acausally- disconnected region inside the horizon. Outflow conditions will be used at the inner boundary by extrapolating the inner-most cell’s values towards the event horizon; this technique has been found to work well in similar studies of Bondi-Hoyle accretion performed in Font & Ib´a˜nez (1998); Font et al. (1999); Zanotti et al. (2011). The initial wind conditions will be set directly at the outer boundary in the upstream direction π/2 < ϕ < 3π/2, while outflow conditions will be used in the downstream region. The domain will use an initial domain discretized into 256 radial cells and 128 azimuthal cells. Unlike the uniform grid used in previous simulations, this simulation will make use of the adaptive mesh refinement (AMR) capabilities in Flash-X via the Paramesh AMR library (MacNeice et al., 2000). The simulation uses three levels of refinement and the Flash-X default second-order monotonic interpolation for refinement operations.1 At each refinement level, the domain is broken up into blocks of size 16 × 16 cells, with a layer of four guard cells on each side. The simulation was ran until a time t = 1500, and the Cartesian projection of the results is displayed in fig. 6.23. This allowed for sufficient time for the expected shock cone downstream from the black hole to form. The three refinement levels were sufficient to resolve the development of the shock cone and maintain numerical stability without a significantly more restrictive time-step size that would be necessary if using a uniform grid of similar base resolution. These results compare favorably with similar simulations performed in Font & Ib´a˜nez (1998); Zanotti et al. (2011); Blakely & Nikiforakis (2015); Donmez (2021), and serve 1Second-order interpolation is not ideal for the fourth-order methods used by the GRFD solver, but was chosen for testing purposes as the less-often used higher-order interpolators available in Flash-X currently require modifications of the Grid module and its interface to Paramesh to access. 161 to verify the multi-dimensional general relativistic capabilities of the GRFD solver. These results also demonstrate the compatibility with the AMR capabilities in Flash-X, even in the presence of a black hole. Further testing of these AMR capabilities is necessary to determine the requirements for interpolation and any special considerations that must be made for dealing with black hole spacetimes. Figure 6.23: Cartesian projection of the results for the rest-mass density at t = 1500 in the Bondi-Hoyle accretion problem. A constant mach-3 wind enters the domain from the left and accretes onto a Schwarzschild black hole (black region at the origin). Mesh block structure is shown in the lower region. 6.4 Z4c and CCZ4 The new Flash-X Spacetime physics module was created to manage the metric quantities and support dynamic spacetime evolution. This new module provides the grid variables for 162 the lapse α, shift vector βi, spatial metric γij , the extrinsic curvature Kij , and the three projections of the stress-energy tensor Sij . The grid variables for the metric Si , and quantities are required by the other general relativistic solvers, and are held static by default E , if no specific implementation for a spacetime solver is requested for a simulation. The grid variables for the projections of the total stress-energy tensor provide a common location for all physics solvers to add their contributions. The Eulerian projections were chosen to represent the stress-energy tensor since these quantities are either easily calculated or directly evolved by the physics solvers, and will be directly used by spacetime solvers. The Spacetime module also provides the tensor-indexing scheme used by the code-generator, i.e., the named integers for the x, y, z-components for tensors of rank one and higher for use as array indices, including the reduction of symmetric indices to a single dimension of an array. Both the Z4c and CCZ4 formulations described in chapter 5 are provided as implemen- tations of the new Spacetime module. For both, the code-generator is used to create the kernel subroutines responsible for calculating the right-hand side terms of the evolution equations, converting the evolved variables to and from the 3+1 split metric quantities, and calculating the violations of the constraint equations as monitors of the stability of the evolving spacetime. These kernels are applied cell-by-cell across blocks of data in the grid. Both implementations make use of the fourth-order finite-difference operators described in chapter 5. This section will present a series of initial test problems that demonstrate the correctness of the code-generator and the accuracy of the solvers. Beyond these initial problems, further tests of more dynamic spacetimes will require increased compatibility between the spacetime solvers and the adaptive mesh refinement capabilities in Flash-X. The currently available refinement criteria and interpolation schemes have proven inadequate for minimizing the 163 build-up of constraint violations, and will require further study and testing to fully make use of alongside the Z4c and CCZ4 spacetime solvers. Due to this, most tests will be restricted to using a uniform grid, but a demonstration of the refinement-related issues will be presented for comparison to an equivalent uniform grid case. In all cases, the following tests will all use the MoL ERK-RK4 time-integrator (see appendix G.1). 6.4.1 Linear Wave The first set of tests examines the ability of the spacetime Z4c and CCZ4 solvers to propagate a gravitational wave. This test is based on the linear wave test included in the “Apples with Apples” numerical relativity testbed proposed in Alcubierre et al. (2003); Babiuc et al. (2008). The stable propagation of a linear wave serves as a proxy for evolving a gravitational wave far from its source, and will verify the accuracy of the solvers and their constraint- damping properties. The linear wave test is setup following the specifications in Babiuc et al. (2008). A trace- free perturbation will be made to a Minkowski spacetime in a Cartesian coordinate basis by including a linearized plane wave along the x-axis in the transverse components of the spatial metric, such that the line element takes the form ds2 = − dt2 + dx2 + (1 + B) dy2 + (1 B) dz2 , − (6.44) where the perturbation is given by the wave B = A sin t) 2π(x d − , (cid:21) (cid:20) (6.45) 164 with an amplitude A and wavelength d. It follows that the lapse, shift vector, and spatial metric are α = 1, βi = 0, γij = diag(1, 1 + B, 1 B). − (6.46) Since the shift vector is zero, the extrinsic curvature can be found from the time derivative of the spatial metric (Baumgarte & Shapiro, 2010) Kij = 1 2α − ∂tγij = diag 0, (cid:18) 1 2 − ∂tB, 1 2 ∂tB . (cid:19) (6.47) The amplitude and the wavelength of the perturbation are set to A = 10− 8 and d = 1. The domain spans 0 < x < 1 to cover one full period of the wave along the x-axis. Three sets of simulations at different resolutions are performed, with grid cells of size ∆x = ∆y = ∆z = 1/(50ρ) for ρ = 1, 2, 4. The limits of y, z-axes will be set such that there are four cells along each of these axes. Periodic boundary conditions will be applied along all spatial dimensions. Simulations are ran for each grid resolution using both the Z4c and CCZ4 solvers, and evolved until a time t = 100. Time-steps will be determined by the light- crossing time of a cell limited by Ccfl = 0.25. The Z4c tests will set the damping parameters κ1 = 0.02 and κ2 = 0 and η = 2, while CCZ4 sets sets the damping parameters to zero such that the waveform is not damped away. Additionally, the Kreiss-Oliger damping parameters are set to σ = 0.2 for Z4c and σ = 0.9 for CCZ4. All of these parameters typically need to be tuned for different simulations and setups, as there is no consensus in the literature on values that work best in all situations. The results for the Z4c simulations are shown in fig. 6.24, while the results for the 165 CCZ4 simulations are shown in fig. 6.25. Each figure compares the maximum Hamiltonian constraint violation and errors in the offset, amplitude, and phase of the waves, at each resolution. The errors in the waves as compared to the analytic solution for a traveling plane wave are determined by the spatial discrete Fourier transform along the x-axis of the waves (as extracted from the transverse metric components) at each time-step. This procedure was Figure 6.24: Results of the linear wave test performed by the Z4c solver for each resolution ρ = 1, 2, 4. From top to bottom, the top three plots show the relative error in the offset, amplitude, and phase of the waveform in the spatial metric’s γzz component as compared to the expected solution at each time-step, while the bottom plot shows the largest violation of the Hamiltonian constraint at each time-step. 166 108106104|F0|=1=2=4108106|F1|108106104[argF1]020406080100t10111010||||Linear Wave - Z4c proposed in Daverio et al. (2018), and for the waveform in the γzz component, the Fourier transform takes the form Fk(t) = 1 N N γzz (t, xj) (cid:88)j=1 (cid:2) 1 exp − (cid:3) 2πik xj − (cid:0) t , (cid:1)(cid:3) − (cid:2) (6.48) where N = 50ρ is the number of grid cells along the x-axis, and the metric component Figure 6.25: Results of the linear wave test performed by the CCZ4 solver for each resolution ρ = 1, 2, 4. From top to bottom, the top three plots show the relative error in the offset, amplitude, and phase of the waveform in the spatial metric’s γzz component as compared to the expected solution at each time-step, while the bottom plot shows the largest violation of the Hamiltonian constraint at each time-step. 167 107104|F0|=1=2=4108106104|F1|108106104[argF1]020406080100t101210111010||||Linear Wave - CCZ4 is explicitly written to depend on the time t and its spatial location xj, the cell-centered coordinate in the j-th cell. The k = 0 Fourier component corresponds to the integral of the wave over the domain; since the domain spans one full period, this integral goes to zero if the wave’s amplitude has not drifted away from being centered around zero. The k = 1 Fourier component describes the shape of the wave, with the magnitude and argument corresponding to the amplitude and phase, respectively. The relative errors used in figs. 6.24–6.25 are defined in terms of these Fourier components as δ F0| | = | F0| A , δ F1| | = | F1| − A A , δ[arg F1] = arg F1 + (cid:12) (cid:12) (cid:12) π 2 , (cid:12) (cid:12) (cid:12) (6.49) where the initial phase of the wave in the γzz , − π/2, is accounted for in the relative phase difference. Overall, the Z4c and CCZ4 solvers produce very similar results that, even though they contain small but acceptable amounts of constraint violation, behave stably and do not produce any significant errors in the evolution of the linear waves. These results compare favorably with similar tests of Z4c and CCZ4 solvers performed in Cao & Hilditch (2012); Daverio et al. (2018); Daszuta et al. (2021). 6.4.2 Black Hole Stability The next test examines the ability of the spacetime solvers to maintain a stable black hole solution. These tests will further assess the constraint-damping properties and accuracy of the Z4c and CCZ4 solvers. Additionally, the challenges of using adaptive mesh refinement (AMR) in these problems will be examined. An initial Schwarzschild black hole in horizon-piercing isotropic Cartesian coordinates will be used in these simulations. The Schwarzschild solution in isotropic coordinates is 168 conformally flat, so it is straightforward to set the initial Z4 conformally-related and gauge variables. In these coordinates, the spacetime time for a Schwarzschild black hole of mass M is described by the lapse and spatial metric (Baumgarte & Shapiro, 2010) α = M/(2r) 1 1 + M/(2r) − , γij = 1 + (cid:18) 4 ηij , M 2r (cid:19) (6.50) where ηij is the Minkowski spatial metric; the shift vector and extrinsic curvature are zero. In these coordinates, the event horizon of the black hole is located at r = M/2. In all simulations, the black hole mass will be set to M = 1. A first test was ran using a three-dimensional uniform grid with cell-sizes ∆x = ∆y = ∆z = 0.0125. For practical purposes, the grid is limited to a long thin slice of size 512 4 4 × × spanning 0 < x < 6.4 and 0 < y, z < 0.05. A reflective condition is used at the x, y, z = 0 boundaries, an outflow condition is used at the outer x-boundary, and the outer y, z boundaries are set analytically as to not produce excessive constraint violations near the black hole. Ideally, radiative or constraint-preserving boundary conditions should be enforced at the outer boundaries to prevent the inflow of constraint violations (Ruiz et al., 2011; Hilditch et al., 2013), but the required ability to evolve data in the guard cells at these boundaries is not currently available in the MoL time-integrators Flash-X.2 The Z4c simulation sets the damping parameters to κ1 = 0.07, κ2 = 0, and η = 2, while the CCZ4 simulation sets κ1 = 0.1, κ2 = 0, κ3 = 1, and η = 2. Kreiss-Oliger dissipation is set to σ = 0.02 for Z4c, and σ = 0.2 for CCZ4. As with the linear wave tests, these parameters require tuning for each simulation. The results for the Z4c solver are displayed in fig. 6.26, and show the maximum constraint 2The MoL time-integrators store the intermediate states’ right-hand side terms in grid-managed scratch memory, which does not contain guard cells in all grid implementations. 169 violations on the grid at each time-step as measured by the Hamiltonian constraint from H Eq. (5.20), the magnitude of the momentum constraint = M i using Eq. (5.20), the MiM (cid:113) timelike (Θ) and spatial (Zi) projections of the Z4 vector, and a combined constraint monitor = C 2 + H MiM i + Θ2 + 4Zi Zi. The levels of constraint violations approach and remain steady around time t = 100. The CCZ4 results are displayed in fig. 6.27, and show the (cid:113) maximum Hamiltonian constraint violation at every time-step; the current implementation of the CCZ4 solver does not output the additional monitors at every time-step yet. In this case, the constraint violations stabilize much sooner around a time t = 20, albeit the oscillatory pattern damps out more slowly than the Z4c case. For both sets of results, the region inside the event horizon is excluded from the calculations of the maximum constraint Figure 6.26: Results of the Schwarzschild black hole stability test performed by the Z4c solver using a uniform grid. 170 050100150200250300350400t10121010108106104LZ=2+ii+2+4ii violations; these will be much higher in this region, but this region is acausally disconnected from the exterior of the black hole. In all cases, these results compare favorably with similar tests performed in Weyhausen et al. (2012); Clough et al. (2015), and validate the ability of the Z4c and CCZ4 solvers to evolve black hole spacetimes. Further simulations were performed with the solvers to test compatibility with the AMR capabilities in Flash-X. The same general setups were used, but the long, thin slice near the x-axis was extended to cover a domain 0 < x, y < 3.2 and 0 < z < 1.6, with a base resolution of ∆x = ∆y = ∆z = 0.1. Paramesh was used as the AMR backend, with three levels of refinement, and the ratio of the second- and first-derivatives of the conformal factor was used as the refinement criterion (this is currently the only criterion available in Flash-X). Figure 6.27: Results of the Schwarzschild black hole stability test performed by the CCZ4 solver using a uniform grid. 171 020406080100120t1010109108107|||| This criterion was sufficient to further resolve the grid in the vicinity of the black hole. Simulation-specific overrides of the AMR interpolators allowed for the use of the fourth- order interpolation scheme in Paramesh; without these overrides, higher-order interpolators are currently inaccessible via the Flash-X interface to Paramesh. The Z4c solver managed to evolve the spacetime stably for a short time until t = 10, but the constraint violations rapidly build up and prevent the simulation from running anywhere near as long as its uniform grid counterpart. The CCZ4 solver’s AMR simulations, however, become unstable within a few time-steps due to large constraint violation build- ups. Figure 6.28 shows the more rapid build-up of the constraint violations, including a much higher initial violation of the Hamiltonian constraint that results from the initial refinement Figure 6.28: Results of the Schwarzschild black hole stability test performed by the Z4c solver using AMR. 172 0246810t10121010108106104102LZ=2+ii+2+4ii of the grid after setting the initial data. Again, these results exclude the region inside the event horizon, where the constraint violations are much higher. These constraint violations quickly outpace those in the uniform grid simulations, leading to an unstable evolution. Further examination of the results for the Z4c AMR simulations shows not only a build- up in constraint violations after the initial grid refinement, but also during guard cell filling operations across the refinement boundaries. Figure 6.29 shows the spatial dependence of Hamiltonian constraint violation in the layer of cells adjacent to the xy-plane at a time t = 1, and includes an overlay of the blocks at different refinement levels. While the largest constraint violations exist inside the event horizon as expected, a clear pattern of higher levels of constraint violations can be seen propagating outwards from the refinement boundaries. Figure 6.29: Spatial distribution of the Hamiltonian constraint violations at a time t = 1 during the evolution of a Schwarzschild black hole performed by the Z4c solver using AMR. 173 At a later time t = 10, these constraint violations have spread throughout the domain, as can be seen in fig. 6.30. The build-up is significantly worse near the region just outside of the event horizon, leading to the subsequent unstable evolution of the spacetime. Figure 6.30: Spatial distribution of the Hamiltonian constraint violations at a time t = 10 during the evolution of a Schwarzschild black hole performed by the Z4c solver using AMR. The use of AMR is essential for practical simulations of dynamic spacetimes. Based on these initial tests, the current AMR capabilities in Flash-X are not compatible with the requirements for these simulations, as high levels of constraint violation are introduced during the initial refinement operations and guard cell filling across refinement operations. Further study is necessary to fully understand the cause of these failures. Continuing work seeks to remedy these issues and provide more robust and accessible capabilities for higher-order interpolation across refinement levels, as well as improving and adding refinement criteria 174 more suitable for use in evolving a dynamic spacetime. 175 Chapter 7 Summary This work has presented a series of general relativistic radiation transport, hydrodynamics, and spacetime solvers for use in simulations of neutron star mergers (NSMs) and core-collapse supernovae (CCSNe). These simulations are sensitive to the methods and approximations made, particularly for how neutrinos and their interactions with matter are included. The formalisms presented here have all been implemented and tested in Flash-X. Work continues on coupling these solvers and developing additional capabilities necessary for performing the large-scale multi-physics simulations required for NSMs and CCSNe. A new general relativistic moment evolution scheme for general relativistic neutrino ra- diation transport using a novel frequency discretization was presented in chapter 3. This scheme utilizes the tried-and-tested M1 formalism that allows for more detailed calculations than simpler methods, like neutrino leakage schemes, while providing increased computa- tional efficiency over methods that try to directly tackle solving seven-dimensional Boltz- mann equations for the neutrino distribution functions. A pseudospectral discretization of the neutrino frequency “axis” permits direct use of the monochromatic moment projections and offers computational savings by requiring fewer overall points in frequency space as com- pared to the more commonly used frequency-bin method. This leads to a smaller memory footprint and increased efficiency and accuracy in calculating the frequency derivatives and integrals present in the redshifting and neutrino-matter interaction source terms. The im- plemented GRM1 solver’s capabilities in flat and curved spacetimes, in the optically thin and thick limits, and its treatment of velocity-dependence at relativistic velocities were verified with a rigorous battery of test problems as presented in chapter 6. 176 A high-order finite-difference scheme for general relativistic hydrodynamics was presented in chapter 4. Reconstruction of the characteristic fluxes robustly captures shocks and other discontinuities that may form in the fluid. In chapter 6, the implemented GRFD solver was verified to resolve such features in the presence of relativistic velocities in both flat and curved spacetimes. Additionally, the implementation of the formalism proves compatible with the adaptive mesh refinement (AMR) capabilities in Flash-X, providing a basis for continuing work on improving the AMR capabilities for all of the new and future general relativistic solvers. A set of dynamic spacetime solvers utilizing the Z4 formalism were presented in chapter 5 alongside a new suite of code generation utilities for translating the often tensor-algebra- heavy equations into usable Fortran code. The Z4c and CCZ4 solvers provide constraint damping and propagation schemes for stably integrating Einstein’s equations of general rel- ativity describing the structure of spacetime. The new code generation utilities connect the robust symbolic tensor algebra module in the Python symbolic algebra package SymPy to improved Fortran code generation and printing capabilities. The behavior and accuracy of both solvers were verified in chapter 6, but they also demonstrated less-than-ideal compati- bility with the AMR capabilities in Flash-X. The use of AMR is absolutely crucial for the highly dynamic spacetimes outside of compact objects, and work continues on mitigating the constraint violation errors produced across refinement levels and developing new refinement criteria suitable for use in NSM and CCSN simulations. All of these solvers have been implemented in Flash-X along with supporting infras- tructure and capabilities for tying everything together. Chief among these is the new time- integrators using a method-of-lines (MoL) time discretization, which provides an alternative to the rudimentary operator-split method that delegates time-integration responsibility to 177 each physics solver on a turn-by-turn basis. The new discretization allows for more con- sistent coupling of the equations managed by each solver on a per-stage level of a shared common time-integration scheme. A series of explicit-only, implicit-explicit, and implicit- explicit multi-rate methods are provided, and are easily extended with the addition of new Butcher tableaus. For the eventual application of these solvers to simulations of NSMs and CCNSe, there are some remaining challenges to address. Improvements and extensions of the AMR ca- pabilities in Flash-X are underway. Higher-order interpolation methods for prolongation and restriction operations across coarse-fine boundaries are necessary for minimizing the build-up of constraint violations when filling guard cells and creating new refinement lev- els. Spacetime-aware refinement criteria will also be necessary for such tasks as ensuring coarse-fine boundaries are not near an apparent horizon, which could lead to the acausal propagation of information. Generating constraint-satisfying initial data for NSMs and CCSNe and incorporating it into Flash-X will also be necessary. The ideal solution will make use of publicly available utilities, such as the spectral solvers for initial data provided in the LORENE (Gourgoulhon et al., 2001; Taniguchi et al., 2001; Taniguchi & Gourgoulhon, 2002a,b, 2003; Bejger et al., 2005; Grandcl´ement, 2006) and Kadath (Grandcl´ement, 2010; Papenfort et al., 2021) codes. An interface between solvers such as these and Flash-X will allow the rapid development of initial data for running sequences of NSM and CCSN simulations. 178 BIBLIOGRAPHY Abbott, B. P., Abbott, R., Abbott, T. D., et al. 2017, Physical Review Letters, 119, 161101, doi: 10.1103/PhysRevLett.119.161101 Abdikamalov, E., Burrows, A., Ott, C. D., et al. 2012, The Astrophysical Journal, 755, 111, doi: 10.1088/0004-637X/755/2/111 Alcubierre, M., Allen, G., Bona, C., et al. 2003, Classical and Quantum Gravity, 21, 589613, doi: 10.1088/0264-9381/21/2/019 Alic, D., Bona-Casas, C., Bona, C., Rezzolla, L., & Palenzuela, C. 2012, Physical Review D, 85, 064040, doi: 10.1103/PhysRevD.85.064040 Anders, E., & Grevesse, N. 1989, Geochimica et Cosmochimica Acta, 53, 197214, doi: 10. 1016/0016-7037(89)90286-x Arlandini, C., K¨appeler, F., Wisshak, K., et al. 1999, The Astrophysical Journal, 525, 886, doi: 10.1086/307938 Arnowitt, R., Deser, S., & Misner, C. W. 1962, in in Gravitation: An Introduction to Current Research (Chap. 7), ed. L. Witten (John Wiley & Sons Inc), 227 Asahina, Y., Takahashi, H. R., & Ohsuga, K. 2020, The Astrophysical Journal, 901, 96, doi: 10.3847/1538-4357/abaf51 Ascher, U. M., Ruuth, S. J., & Spiteri, R. J. 1997, Applied Numerical Mathematics, 25, 151167, doi: 10.1016/s0168-9274(97)00056-1 Baade, W., & Zwicky, F. 1934, Physical Review, 46, 76, doi: 10.1103/PhysRev.46.76.2 Babiuc, M. C., Husa, S., Alic, D., et al. 2008, Classical and Quantum Gravity, 25, 125012, doi: 10.1088/0264-9381/25/12/125012 Banik, S., Hempel, M., & Bandyopadhyay, D. 2014, The Astrophysical Journal Supplement Series, 214, 22, doi: 10.1088/0067-0049/214/2/22 Banyuls, F., Font, J. A., Ib´a˜nez, J. M., Mart´ı, J. M., & Miralles, J. A. 1997, The Astrophys- ical Journal, 476, 221, doi: 10.1086/303604 Baumgarte, T. W., & Shapiro, S. L. 1998, Physical Review D, 59, 024007, doi: 10.1103/ PhysRevD.59.024007 Baumgarte, T. W., & Shapiro, S. L. 2010, Numerical Relativity: Solving Einstein’s Equations on the Computer (Cambridge University Press), doi: 10.1017/CBO9781139193344 179 Bejger, M., Gondek-Rosiska, D., Gourgoulhon, E., et al. 2005, Astronomy and Astrophysics, 431, 297306, doi: 10.1051/0004-6361:20041441 Bernuzzi, S., & Hilditch, D. 2010, Physical Review D, 81, 084003, doi: 10.1103/PhysRevD. 81.084003 Blakely, P. M., & Nikiforakis, N. 2015, A&A, 583, A90, doi: 10.1051/0004-6361/201525763 Bonazzola, S., Gourgoulhon, E., Grandcl´ement, P., & Novak, J. 2004, Physical Review D, 70, 104007, doi: 10.1103/PhysRevD.70.104007 Boyd, J. 2013, Chebyshev and Fourier Spectral Methods: Second Revised Edition, Dover Books on Mathematics (Dover Publications) Brent, R. 2002, Algorithms for Minimization Without Derivatives, Dover Books on Mathe- matics (Dover Publications) Bruenn, S. W. 1985, The Astrophysical Journal Supplement Series, 58, 771, doi: 10.1086/ 191056 Burrows, A., Reddy, S., & Thompson, T. A. 2006, Nuclear Physics A, 777, 356, doi: 10. 1016/j.nuclphysa.2004.06.012 Butcher, J. C. 1963, Journal of the Australian Mathematical Society, 3, 185201, doi: 10. 1017/S1446788700027932 Cao, Z., & Hilditch, D. 2012, Physical Review D, 85, 124032, doi: 10.1103/PhysRevD.85. 124032 Cardall, C. Y., Endeve, E., & Mezzacappa, A. 2013, Physical Review D, 87, 103004, doi: 10. 1103/PhysRevD.87.103004 Cernohorsky, J., & Bludman, S. A. 1994, The Astrophysical Journal, 433, 250, doi: 10. 1086/174640 Cheong, P. C.-K., Ng, H. H.-Y., Lam, A. T.-L., & Li, T. G. F. 2023, The Astrophysical Journal Supplement Series, 267, 38, doi: 10.3847/1538-4365/acd931 Chinomona, R., & Reynolds, D. R. 2021, SIAM Journal on Scientific Computing, 43, A3082, doi: 10.1137/20M1354349 Clough, K., Figueras, P., Finkel, H., et al. 2015, Classical and Quantum Gravity, 32, 245011, doi: 10.1088/0264-9381/32/24/245011 Cordero-Carri´on, I., Cerd´a-Dur´an, P., Dimmelmeier, H., et al. 2009, Physical Review D, 79, 024017, doi: 10.1103/PhysRevD.79.024017 180 Daszuta, B., Zappa, F., Cook, W., et al. 2021, The Astrophysical Journal Supplement Series, 257, 25, doi: 10.3847/1538-4365/ac157b Daverio, D., Dirian, Y., & Mitsou, E. 2018, arXiv e-prints, arXiv:1810.12346, doi: 10.48550/ arXiv.1810.12346 Del Zanna, L., Zanotti, O., Bucciantini, N., & Londrillo, P. 2007, Astronomy and Astro- physics, 473, 11, doi: 10.1051/0004-6361:20077093 Donmez, O. 2021, European Physical Journal C, 81, 113, doi: 10.1140/epjc/ s10052-021-08923-1 Dubey, A., Antypas, K., Ganapathy, M. K., et al. 2009, Parallel Computing, 35, 512, doi: https://doi.org/10.1016/j.parco.2009.08.001 Dubey, A., Weide, K., ONeal, J., et al. 2022, SoftwareX, 19, 101168, doi: https://doi.org/ 10.1016/j.softx.2022.101168 Dumbser, M., Guercilena, F., K¨oppel, S., Rezzolla, L., & Zanotti, O. 2018, Physical Review D, 97, 084053, doi: 10.1103/PhysRevD.97.084053 Duyvendak, J. J. L. 1942, Publications of the Astronomical Society of the Pacific, 54, 91, doi: 10.1086/125409 Edgar, R. 2004, New Astronomy Reviews, 48, 843, doi: 10.1016/j.newar.2004.06.001 Eichler, D., Livio, M., Piran, T., & Schramm, D. N. 1989, Nature, 340, 126, doi: 10.1038/ 340126a0 Fan, Y.-Z., Han, M.-Z., Jiang, J.-L., Shao, D.-S., & Tang, S.-P. 2024, Physical Review D, 109, 043052, doi: 10.1103/PhysRevD.109.043052 Farmer, R., Fields, C. E., Petermann, I., et al. 2016, The Astrophysical Journal Supplement Series, 227, 22, doi: 10.3847/1538-4365/227/2/22 Font, J. A., & Ib´a˜nez, J. M. 1998, The Astrophysical Journal, 494, 297, doi: 10.1086/305205 Font, J. A., Ib´a˜nez, J. M., & Papadopoulos, P. 1999, Monthly Notices of the Royal Astro- nomical Society, 305, 920, doi: 10.1046/j.1365-8711.1999.02459.x Foucart, F. 2023, Living Reviews in Computational Astrophysics, 9, 1, doi: 10.1007/ s41115-023-00016-y Foucart, F., O’Connor, E., Roberts, L., et al. 2015, Physical Review D, 91, 124021, doi: 10. 1103/PhysRevD.91.124021 181 Freiburghaus, C., Rosswog, S., & Thielemann, F. K. 1999, The Astrophysical Journal, 525, L121, doi: 10.1086/312343 Fryxell, B., Olson, K., Ricker, P., et al. 2000, The Astrophysical Journal Supplement Series, 131, 273, doi: 10.1086/317361 Galeazzi, F., Kastaun, W., Rezzolla, L., & Font, J. A. 2013, Physical Review D, 88, 064009, doi: 10.1103/PhysRevD.88.064009 Gamma, E., Helm, R., Johnson, R., & Vlissides, J. 1995, Design patterns: elements of reusable object-oriented software (USA: Addison-Wesley Longman Publishing Co., Inc.) Goriely, S., Demetriou, P., Janka, H. T., Pearson, J. M., & Samyn, M. 2005, Nuclear Physics A, 758, 587, doi: 10.1016/j.nuclphysa.2005.05.107 Gourgoulhon, E., Grandcl´ement, P., Taniguchi, K., Marck, J.-A., & Bonazzola, S. 2001, Phys. Rev. D, 63, 064029, doi: 10.1103/PhysRevD.63.064029 Grandcl´ement, P. 2006, Phys. Rev. D, 74, 124002, doi: 10.1103/PhysRevD.74.124002 Grandcl´ement, P. 2010, Journal of Computational Physics, 229, 3334, doi: 10.1016/j.jcp. 2010.01.005 Greif, S. K., Hebeler, K., Lattimer, J. M., Pethick, C. J., & Schwenk, A. 2020, The Astro- physical Journal, 901, 155, doi: 10.3847/1538-4357/abaf55 Gundlach, C., Calabrese, G., Hinder, I., & Mart´ın-Garc´ıa, J. M. 2005, Classical and Quantum Gravity, 22, 3767, doi: 10.1088/0264-9381/22/17/025 Hayes, J. C., & Norman, M. L. 2003, The Astrophysical Journal Supplement Series, 147, 197, doi: 10.1086/374658 Hempel, M., Fischer, T., Schaffner-Bielich, J., & Liebend¨orfer, M. 2012, The Astrophysical Journal, 748, 70, doi: 10.1088/0004-637X/748/1/70 Hernandez, Walter C., J., & Misner, C. W. 1966, The Astrophysical Journal, 143, 452, doi: 10.1086/148525 Hewish, A., Bell, S. J., Pilkington, J. D. H., Scott, P. F., & Collins, R. A. 1968, Nature, 217, 709, doi: 10.1038/217709a0 Hilditch, D., Bernuzzi, S., Thierfelder, M., et al. 2013, Physical Review D, 88, 084057, doi: 10.1103/PhysRevD.88.084057 Hotokezaka, K., Beniamini, P., & Piran, T. 2018, International Journal of Modern Physics D, 27, 1842005, doi: 10.1142/S0218271818420051 182 Ibanez, J. M., Aloy, M. A., Font, J. A., et al. 1999, arXiv e-prints, astro, doi: 10.48550/ arXiv.astro-ph/9911034 Isenberg, J. A. 2008, International Journal of Modern Physics D, 17, 265, doi: 10.1142/ S0218271808011997 Jiang, G.-S., & Shu, C.-W. 1996, Journal of Computational Physics, 126, 202, doi: 10.1006/ jcph.1996.0130 Kasen, D., Metzger, B., Barnes, J., Quataert, E., & Ramirez-Ruiz, E. 2017, Nature, 551, 80, doi: 10.1038/nature24453 Kurganov, A., & Tadmor, E. 2002, Numerical Methods for Partial Differential Equations, 18, 584, doi: https://doi.org/10.1002/num.10025 Kutta, W. 1901, Beitrag zur nherungsweisen Integration totaler Differentialgleichungen (Teubner) Lattimer, J. M., & Schramm, D. N. 1974, The Astrophysical Journal, 192, L145, doi: 10. 1086/181612 Lattimer, J. M., & Swesty, D. F. 1991, Nuclear Physics A, 535, 331, doi: 10.1016/ 0375-9474(91)90452-C LeVeque, R. J. 2002, Finite Volume Methods for Hyperbolic Problems (Cambridge University Press), doi: 10.1017/cbo9780511791253 —. 2007, Finite difference methods for ordinary and partial differential equations: steady- state and time-dependent problems (SIAM) Liebend¨orfer, M., Rampp, M., Janka, H. T., & Mezzacappa, A. 2005, The Astrophysical Journal, 620, 840, doi: 10.1086/427203 Lippuner, J., & Roberts, L. F. 2017, The Astrophysical Journal Supplement Series, 233, 18, doi: 10.3847/1538-4365/aa94cb Liptai, D., & Price, D. J. 2019, Monthly Notices of the Royal Astronomical Society, 485, 819, doi: 10.1093/mnras/stz111 MacNeice, P., Olson, K. M., Mobarry, C., de Fainchtein, R., & Packer, C. 2000, Computer Physics Communications, 126, 330354, doi: 10.1016/s0010-4655(99)00501-9 Mart´ın, M. P., Taylor, E. M., Wu, M., & Weirs, V. G. 2006, Journal of Computational Physics, 220, 270, doi: 10.1016/j.jcp.2006.05.009 183 May, M. M., & White, R. H. 1966, Phys. Rev., 141, 1232, doi: 10.1103/PhysRev.141.1232 Mayall, N. U., & Oort, J. H. 1942, Publications of the Astronomical Society of the Pacific, 54, 95, doi: 10.1086/125410 Metcalf, M., Reid, J., & Cohen, M. 2018, Modern Fortran Explained: Incorporating Fortran 2018 (Oxford University Press), doi: 10.1093/oso/9780198811893.001.0001 Meurer, A., Smith, C. P., Paprocki, M., et al. 2017, PeerJ Computer Science, 3, e103, doi: 10.7717/peerj-cs.103 Mezzacappa, A., & Bruenn, S. W. 1993, The Astrophysical Journal, 405, 669, doi: 10.1086/ 172395 Mezzacappa, A., & Messer, O. 1999, Journal of Computational and Applied Mathematics, 109, 281319, doi: 10.1016/s0377-0427(99)00162-4 Minerbo, G. N. 1978, Journal of Quantitative Spectroscopy and Radiative Transfer, 20, 541545, doi: 10.1016/0022-4073(78)90024-9 Misner, C. W., & Sharp, D. H. 1964, Phys. Rev., 136, B571, doi: 10.1103/PhysRev.136. B571 Misner, C. W., Thorne, K. S., & Wheeler, J. A. 2017, Gravitation Mohr, P. J., Newell, D. B., & Taylor, B. N. 2015, CODATA Recommended Values of the Fundamental Physical Constants: 2014, Zenodo, doi: 10.5281/zenodo.22826 M¨osta, P., Mundim, B. C., Faber, J. A., et al. 2014, Classical and Quantum Gravity, 31, 015005, doi: 10.1088/0264-9381/31/1/015005 M¨uller, B., Janka, H.-T., & Dimmelmeier, H. 2010, The Astrophysical Journal Supplement Series, 189, 104, doi: 10.1088/0067-0049/189/1/104 Murchikova, E. M., Abdikamalov, E., & Urbatsch, T. 2017, Monthly Notices of the Royal Astronomical Society, 469, 1725, doi: 10.1093/mnras/stx986 O’Connor, E. 2015, The Astrophysical Journal Supplement Series, 219, 24, doi: 10.1088/ 0067-0049/219/2/24 O’Connor, E., & Ott, C. D. 2010, Classical and Quantum Gravity, 27, 114103, doi: 10.1088/ 0264-9381/27/11/114103 O’Connor, E. P., & Couch, S. M. 2018a, The Astrophysical Journal, 854, 63, doi: 10.3847/ 1538-4357/aaa893 184 —. 2018b, The Astrophysical Journal, 865, 81, doi: 10.3847/1538-4357/aadcf7 Oettinger, D., Mendoza, M., & Herrmann, H. J. 2013, Physical Review E, 88, 013302, doi: 10.1103/PhysRevE.88.013302 Oppenheimer, J. R., & Volkoff, G. M. 1939, Phys. Rev., 55, 374, doi: 10.1103/PhysRev.55. 374 Pajkos, M. A. 2022, PhD thesis, doi: 10.25335/JW6W-3P83 Papenfort, L. J., Tootle, S. D., Grandcl´ement, P., Most, E. R., & Rezzolla, L. 2021, Physical Review D, 104, 024057, doi: 10.1103/PhysRevD.104.024057 Pareschi, L., & Russo, G. 2005, Journal of Scientific Computing, 25, 129, doi: 10.1007/ BF02728986 Patrignani, C., Particle Data Group, Agashe, K., et al. 2016, Chinese Physics C, 40, 100001, doi: 10.1088/1674-1137/40/10/100001 Perego, A., Bernuzzi, S., & Radice, D. 2019, European Physical Journal A, 55, 124, doi: 10. 1140/epja/i2019-12810-7 Perego, A., Cabez´on, R. M., & K¨appeli, R. 2016, The Astrophysical Journal Supplement Series, 223, 22, doi: 10.3847/0067-0049/223/2/22 Peterson, A. J., Willcox, D., & M¨osta, P. 2023, Classical and Quantum Gravity, 40, 245013, doi: 10.1088/1361-6382/ad0b37 Pons, J. A., Ib´a˜nez, J. M., & Miralles, J. A. 2000, Monthly Notices of the Royal Astronomical Society, 317, 550, doi: 10.1046/j.1365-8711.2000.03679.x Press, W. H., Teukolsky, S. A., Vetterling, W. T., & Flannery, B. P. 2007, Numerical Recipes 3rd Edition: The Art of Scientific Computing, 3rd edn. (USA: Cambridge University Press) Pretorius, F. 2005, Classical and Quantum Gravity, 22, 425, doi: 10.1088/0264-9381/22/ 2/014 Radia, M., Sperhake, U., Drew, A., et al. 2022, Classical and Quantum Gravity, 39, 135006, doi: 10.1088/1361-6382/ac6fa9 Radice, D., Bernuzzi, S., Perego, A., & Haas, R. 2022, Monthly Notices of the Royal Astro- nomical Society, 512, 1499, doi: 10.1093/mnras/stac589 Radice, D., Galeazzi, F., Lippuner, J., et al. 2016, Monthly Notices of the Royal Astronomical Society, 460, 3255, doi: 10.1093/mnras/stw1227 185 Radice, D., Perego, A., Hotokezaka, K., et al. 2018, The Astrophysical Journal, 869, 130, doi: 10.3847/1538-4357/aaf054 Radice, D., & Rezzolla, L. 2012, Astronomy & Astrophysics, 547, A26, doi: 10.1051/ 0004-6361/201219735 Radice, D., Rezzolla, L., & Galeazzi, F. 2014, Classical and Quantum Gravity, 31, 075012, doi: 10.1088/0264-9381/31/7/075012 Rampp, M., & Janka, H.-T. 2002, Astronomy & Astrophysics, 396, 361392, doi: 10.1051/ 0004-6361:20021398 Rezzolla, L., Baiotti, L., Giacomazzo, B., Link, D., & Font, J. A. 2010, Classical and Quan- tum Gravity, 27, 114105, doi: 10.1088/0264-9381/27/11/114105 Rezzolla, L., & Zanotti, O. 2013, Relativistic Hydrodynamics (Oxford University PressOx- ford), doi: 10.1093/acprof:oso/9780198528906.001.0001 Rezzolla, L., Zanotti, O., & Pons, J. A. 2003, Journal of Fluid Mechanics, 479, 199, doi: 10. 1017/S0022112002003506 Roberts, L. F., Ott, C. D., Haas, R., et al. 2016, The Astrophysical Journal, 831, 98, doi: 10.3847/0004-637X/831/1/98 Roman, S. 2007, Advanced Linear Algebra, Graduate Texts in Mathematics (Springer New York) Rosswog, S. 2015, Living Reviews in Computational Astrophysics, 1, 1, doi: 10.1007/ lrca-2015-1 Rosswog, S., & Davies, M. B. 2002, Monthly Notices of the Royal Astronomical Society, 334, 481, doi: 10.1046/j.1365-8711.2002.05409.x Rosswog, S., & Liebend¨orfer, M. 2003, Monthly Notices of the Royal Astronomical Society, 342, 673, doi: 10.1046/j.1365-8711.2003.06579.x Rosswog, S., Sollerman, J., Feindt, U., et al. 2018, Astronomy and Astrophysics, 615, A132, doi: 10.1051/0004-6361/201732117 Ruchlin, I., Etienne, Z. B., & Baumgarte, T. W. 2018, Physical Review D, 97, 064036, doi: 10.1103/PhysRevD.97.064036 Ruffert, M., Janka, H. T., & Schaefer, G. 1996, Astronomy and Astrophysics, 311, 532, doi: 10.48550/arXiv.astro-ph/9509006 186 Ruiz, M., Hilditch, D., & Bernuzzi, S. 2011, Physical Review D, 83, doi: 10.1103/physrevd. 83.024025 Runge, C. 1895, Mathematische Annalen, 46, 167, doi: 10.1007/BF01446807 Shibata, M., Kiuchi, K., Sekiguchi, Y., & Suwa, Y. 2011, Progress of Theoretical Physics, 125, 1255, doi: 10.1143/PTP.125.1255 Shibata, M., & Nakamura, T. 1995, Physical Review D, 52, 5428, doi: 10.1103/PhysRevD. 52.5428 Shu, C.-W., & Osher, S. 1988, Journal of Computational Physics, 77, 439, doi: 10.1016/ 0021-9991(88)90177-5 Skinner, M. A., Dolence, J. C., Burrows, A., Radice, D., & Vartanyan, D. 2019, The Astro- physical Journal Supplement Series, 241, 7, doi: 10.3847/1538-4365/ab007f Smit, J. M., Cernohorsky, J., & Dullemond, C. P. 1997, Astronomy and Astrophysics, 325, 203. https://ui.adsabs.harvard.edu/abs/1997A&A...325..203S Sotani, H., Nishimura, N., & Naito, T. 2022, Progress of Theoretical and Experimental Physics, 2022, 041D01, doi: 10.1093/ptep/ptac055 Steiner, A. W., Hempel, M., & Fischer, T. 2013a, The Astrophysical Journal, 774, 17, doi: 10.1088/0004-637X/774/1/17 Steiner, A. W., Lattimer, J. M., & Brown, E. F. 2013b, The Astrophysical Journal, 765, L5, doi: 10.1088/2041-8205/765/1/L5 Symbalisty, E., & Schramm, D. N. 1982, Astrophysical Letters, 22, 143 Taniguchi, K., & Gourgoulhon, E. 2002a, Phys. Rev. D, 65, 044027, doi: 10.1103/PhysRevD. 65.044027 —. 2002b, Phys. Rev. D, 66, 104019, doi: 10.1103/PhysRevD.66.104019 —. 2003, Phys. Rev. D, 68, 124025, doi: 10.1103/PhysRevD.68.124025 Taniguchi, K., Gourgoulhon, E., & Bonazzola, S. 2001, Physical Review D, 64, 064012, doi: 10.1103/PhysRevD.64.064012 Taylor, J. H., Fowler, L. A., & McCulloch, P. M. 1979, Nature, 277, 437, doi: 10.1038/ 277437a0 Thorne, K. S. 1981, Monthly Notices of the Royal Astronomical Society, 194, 439, doi: 10. 1093/mnras/194.2.439 187 Tolman, R. C. 1939, Phys. Rev., 55, 364, doi: 10.1103/PhysRev.55.364 Toro, E. F. 2009, Riemann Solvers and Numerical Methods for Fluid Dynamics: A Practical Introduction (Berlin, Heidelberg: Springer Berlin Heidelberg), doi: 10.1007/b79761 van Riper, K. A., & Lattimer, J. M. 1981, The Astrophysical Journal, 249, 270, doi: 10. 1086/159285 Wald, R. M. 1984, General Relativity (Chicago, USA: Chicago Univ. Pr.), doi: 10.7208/ chicago/9780226870373.001.0001 Weih, L. R., Olivares, H., & Rezzolla, L. 2020, Monthly Notices of the Royal Astronomical Society, 495, 2285, doi: 10.1093/mnras/staa1297 Weyhausen, A., Bernuzzi, S., & Hilditch, D. 2012, Physical Review D, 85, 024038, doi: 10. 1103/PhysRevD.85.024038 Wilson, J. R. 1972, The Astrophysical Journal, 173, 431, doi: 10.1086/151434 Wilson, J. R., & Mathews, G. J. 1995, Phys. Rev. Lett., 75, 4161, doi: 10.1103/ PhysRevLett.75.4161 Wolfram Research, Inc. 2023, Mathematica, Version 13.3. https://www.wolfram.com/ mathematica Zanotti, O., Roedig, C., Rezzolla, L., & Del Zanna, L. 2011, Monthly Notices of the Royal Astronomical Society, 417, 2899, doi: 10.1111/j.1365-2966.2011.19451.x Zhang, W., & MacFadyen, A. I. 2006, The Astrophysical Journal Supplement Series, 164, 255, doi: 10.1086/500792 188 A.1. Notation APPENDIX A. Conventions Throughout this work, the standard metric signature ( − , +, +, +) used in numerical relativity will be assumed. All tensors will be indexed by the lower-case Latin letters a, b, c, . . ., and assume values of 0, 1, 2, 3 for full four-dimensional spacetime components, where 0 is the time component, and 1, 2, 3 are the spatial components. However, the indices i, j, k, l, m, n will refer strictly to spatial-only index values of 1, 2, 3. The choice of Latin indices in lieu of the more commonly used Greek indices is made to avoid confusion with various quantities, such as the lapse α and shift β, as well as the use of ν and σ as subscripts specifying the frequency and species of a neutrino. The restrictions on the index values do not apply when explicitly appearing in summations where their limiting values are given. All symbolic tensor equations will assume the Einstein summation convention unless otherwise noted. All covariant-contravariant pairs of “dummy” indices will imply summation over all possible index values, e.g., computing the contraction vivi = v1v1 + v2v2 + v3v3. (A.1) Free indices do not imply summation, even when repeated, and represent a set of values or equations for specific tensor components. For example, lowering the index of the velocity vj with the spatial metric γij using this convention takes the form v1 = γ11v1 + γ12v2 + γ13v3, vi = γij vj = ⇒ v2 = γ21v1 + γ22v2 + γ23v3, (A.2) v3 = γ31v1 + γ32v2 + γ33v3. 189 For instances where a repeated index appears on one side of an equation but in two covariant or contravariant slots, this will represent only a subset of the tensor’s components, e.g., γii refers to only the diagonal components of the spatial metric. A.2. Geometrized Units A geometrized systems of units will be used throughout this work to simplify the notation in the numerous equations as well as to provide reasonable numerical values for the scales present in neutron star mergers and core-collapse supernovae simulations. The constants G = c = M ⊙ = 1 will be used, where G is Newton’s gravitational constant, M ⊙ is the mass of the sun, and c is the speed of light in a vacuum. The implementations of the solvers presented in this work use the CODATA 2014 (Mohr et al., 2015) and Particle Data Group 2016 Summary Tables (Patrignani et al., 2016)1 G = 6.67408 × 10− 8 cm3 g− 1 s− 2, c = 2.99792458 1010 cm s− 1, × 1033 g. = 1.98848 M ⊙ × (A.3) (A.4) (A.5) In this system of units, the basic scales for mass [M ], length [L], and time [T ] are set to [M ] = M ⊙ , [L] = GM c2 ⊙ , [T ] = GM c3 ⊙ . (A.6) Derived units for areas, volumes, densities, energies, pressures, and opacities can be written in combinations of these units. All quantities measured by these units will be given in units 1The use of these older sets of values is for compatibility with values used throughout Flash-X. 190 of either powers of M ⊙ or c, providing a convenient scale for neutron star mergers. Neutron stars have masses of (M ⊙ O ) and radii of O 106 cm , which gives masses of (1) and radii O (10) in geometrized units. Velocities are then simply fractions of the speed of light, such (cid:0) (cid:1) of O that the magnitude of any velocity v is limited to values 0 v < 1. ≤ Temperatures are treated differently for compatibility with nuclear equation of state tables. These tables typically represent temperatures as energies measured in MeV. This is accomplished by setting the Boltzmann constant kB = 1, which in units of MeV per Kelvin is (Mohr et al., 2015) kB = 8.6173303 × 10− 11 MeV K− 1. (A.7) This allows both temperatures and neutrino frequencies (when further assuming the Planck constant h = 1) in neutron star mergers to take average values ranging from ones to hundreds of MeV. 191 APPENDIX B. Tolman-Oppenheimer-Volkoff Equations The Tolman-Oppenheimer-Volkoff (TOV) equations, named after the authors of Tolman (1939); Oppenheimer & Volkoff (1939), describe the static equilibrium solution for relativis- tic stars. Solutions of the TOV equation are commonly used to describe cold, non-rotating neutron stars. This appendix provides a brief overview of the TOV equations and an alterna- tive form more suitable for numerical integration. The standard form of the TOV equations is based on the presentation in Baumgarte & Shapiro (2010), and is summarized here for reference. Assuming a spherically symmetric spacetime containing an ideal fluid sphere described by an equation of state p(ρ, ϵ), the line element of the metric takes the form ds2 = e2Φ(r) dt2 + e2λ(r) dr2 + r2 dΩ2 , − (B.1) where Φ(r) and λ(r) are two metric potentials that only depend on the radius, and dΩ = dθ2 + sin2 θ dϕ2 is the differential solid angle on the unit sphere. Since the solution in the region exterior to the star must match the Schwarzschild solution, λ(r) can be related to the enclosed mass of the star m(r) as e2λ(r) = 1 (cid:20) 2m(r) r − 1 − . (cid:21) This guarantees that a star of mass M and radius R satisfies m(r λ(r ≥ ≥ R) = M, R) = 1 2 − ln 1 (cid:18) 2M r − (cid:19) 192 (B.2) (B.3) everywhere outside of the star. Using the spacetime metric described by Eq. (B.1) in the Einstein field equations, Eq. (5.1), along with the stress-energy tensor of an ideal perfect fluid in Eq. (4.1), the interior solution for the static equilibrium of the star, i.e., for r R, is ≤ described by the system of differential equations for the mass, pressure, and metric potential Φ(r) dm dr dΦ dr dp dr = 4πr2e, = = m + 4πr3p 2m) r(r , − (e + p) dΦ dr , − (B.4) (B.5) (B.6) where e = ρ(1 + ϵ) is the total energy density. Each possible solution is determined from the central values m(r = 0) = 0, p(r = 0) = pc, (B.7) where pc is the central pressure; other thermodynamic quantities relate to this pressure via the fluid’s equation of state. The central value of Φ is not necessary for integration since Eqns. (B.4)–(B.6) only depend on the derivative of Φ but not its actual value; this will typically be set to zero and later matched onto the Schwarzschild solution. With these initial conditions, Eqns. (B.4)–(B.6) can be integrated out to the surface of the sphere. Unfortunately, outside of a constant density solution, there is no way to determine the radius R of the surface from the initial conditions alone. The surface will be located where the pressure goes to zero, i.e., p(r = R) = 0. Directly integrating Eqns. (B.4)–(B.6) will require checking this condition at every integration step, and repeating the final step at 193 increasingly smaller radial step sizes to find the exact location without stepping past the surface of the star. Instead, it is simpler to recast Eqns. (B.4)–(B.6) as derivatives with respect to the pres- sure, such that the equations can be integrated over the domain pc p > 0. The new system ≥ takes the form, including a new equation for the radius of the star dΦ dp dr dp dm dp = = 1 e + p , − r(r 2m) − m + 4πr3p = 4πr2e dr dp . dΦ dp , (B.8) (B.9) (B.10) These equations can now be integrated out to p = 0 by any explicit integration method suitable for initial value problems, such as the classic fourth-order Runge-Kutta method. Once the surface of the star has been found, the metric potential Φ(r) can be found by matching it onto the Schwarzschild solution Φ(R) = 1 2 ln 1 (cid:18) 2M R − , (cid:19) (B.11) which can then be used as an offset Φ(r ≤ R) to determine the interior solution. The full exterior solution for r > R is then just the Schwarzschild solution in terms of the mass M . The TOV equations do permit an analytic solution for the case of uniform density. This limiting case shows that the maximum compactness of a non-rotating relativistic star is M/R < 4/9 (Baumgarte & Shapiro, 2010). Please refer to Wald (1984); Rezzolla & Zanotti (2013) for more on the uniform density solution. 194 APPENDIX C. Eulerian 3+1 Decomposition of the Spacetime This appendix summarizes the 3+1 decomposition of the spacetime commonly used in nu- merical relativity as presented in Baumgarte & Shapiro (2010), and will highlight some of the necessary concepts and identities used throughout this dissertation. In a 3+1 decompo- sition, the full spacetime is split into spacelike hypersurfaces Σt of constant coordinate time t as measured in the frame of a distant Eulerian observer. In this frame, the four-velocity of the Eulerian observer is timelike and normal to Σt, and it is defined as na = α∇at, − (C.1) where the lapse function α characterizes the separation between the spacetime hypersurfaces. In this 3+1 decomposition, the invariant line element takes the form ds2 = gab dxa dxb = α2 dt2 + γij − dxi + βi dt (cid:16) (cid:17)(cid:16) dxj + βj dt (cid:17) , (C.2) where gab is the spacetime metric, βi is the shift vector characterizing the coordinate shift from one hypersurface to the next, and γij is the spatial metric on Σt. Using the normal- ization nana = − as 1, Eqns. (C.1)–(C.2) show that the Eulerian four-velocity can be written na = − (cid:16) α, 0i , na = α− 1, βi , (cid:17) (cid:16) (cid:17) (C.3) where 0i is the spatial zero-vector. The spatial metric γij acts as a projection operator onto Σt, and from Eqns. (C.2)–(C.3) 195 it follows that γab = gab + nanb. (C.4) Since γabnb = 0, it is useful to note that γa0 = 0, and for spacelike vectors in the Eulerian frame, γab plays the role of the metric, e.g., for a spatial vector vi, the spatial components of the corresponding one-form are vi = γijvj. Terms containing covariant derivatives of the Eulerian four-velocity are commonly en- countered when projecting evolution equations into the spacelike hypersurfaces. Using Eq. (C.1) and Eq. (C.3), some useful identities involving these covariant derivatives are na∇bna = ∇b(nanb) na∇bna = − na∇bna = 0, − (C.5) where the final step follows from the compatibility of the covariant derivative with the spacetime metric, i.e., ∇agbc = 0, and nb∇bna = γb a∇b ln α = ∂aln α. (C.6) The extrinsic curvature of the spacetime hypersurfaces relative to the full spacetime can be characterized by the change in the Eulerian normal four-velocities. With the relations in Eqns. (C.5)–(C.6), it is given as Kab = ∇bna − − nbnc∇cna = ∇bna − − nb∂a ln α, (C.7) from which it follows that naKab = 0. For spatial vectors, it follows from Eqns. (C.2)–(C.3) 196 that nava = nava = 0 = ⇒ va = vjβj, vi , (cid:16) (cid:17) (C.8) leading to some useful identities involving the Eulerian four-velocity and spatial vectors na∇bva = ∇b(nava) va∇bna = va∇bna, − − (C.9) and va ∂na ∂xb = vkβk (cid:16) (cid:17) ∂ ∂xb 1 α (cid:18) − (cid:19) βk ∂ ∂xb vk (cid:34) 1 α (cid:18) (cid:19) + 1 α ∂βk ∂xb (cid:35) vk α ∂βk ∂xb . = − (C.10) In a 3+1 decomposition of the spacetime, the covariant divergence of a tensor Qab c can be written as ∇aQab c = 1 α√γ ∂ ∂xa α√γQab c + Γb daQad (cid:16) (cid:17) Γd caQab d, c − where the Christoffel symbols are Γa bc = gad 1 2 (cid:18) ∂gcd ∂xb + ∂gbd ∂xc − ∂gbc ∂xd . (cid:19) (C.11) (C.12) The Christoffel symbols in Eq. (C.12) are only valid when working with a coordinate basis, which will always be the case throughout this work. 197 APPENDIX D. Deriving the Moment Evolution Equations This appendix provides the lengthier parts of the derivation of the radiation transport mo- ment evolution equations presented in chapter 3. The covariant derivative of the arbitrary- rank moment expansion, Eulerian-projection of the second-rank moment, and the projection of the redshifting frequency-space advection term will be considered separately, and will make use of the 3+1 split spacetime and various identities covered in appendix C. In all of the following derivations, the explicit frequency-subscript will be dropped for clarity — all radiation quantities will be assumed to be for a specific frequency ν, e.g., E E(ν). ≡ D.1. Covariant Derivative of the Moment Expansion This section derives the evolution equations for the moment expansion of radiation distri- bution function. With a more compact notation, the arbitrary-rank moment expansion is repeated here for convenience M Ak ≡ M Ak xb = (cid:16) (cid:17) (cid:90) dVp′ c ν + ucp′ c)k ucp′ − δ ( (cid:0) − 2  (cid:1)  Ak (cid:89)ak∈ ak p′ f(ν′),   (D.1) f where f(ν′) ≡ spacetime coordinates xb results in the three separate terms (cid:16) (cid:17) xb, p′ a . Taking the covariant-divergence of Eq. (D.1) with respect to the ∇bM Akb = ∇bM Akb (cid:104) + ∇bM Akb (cid:104) + ∇bM Akb (cid:104) 3 (cid:105) 2 (cid:105) 1 (cid:105) (D.2) where the first term contains the gradient of the δ-function ∇bM Akb (cid:104) 1 (cid:105) = − (cid:90) ( − dVp′ c)k ucp′ − 1   Ak (cid:89)ak∈ ∂δ ν + ucp′ ucp′ c c) (cid:35) (cid:1) − ∂( (cid:0) , (D.3) p′ bf(ν′) c∇buc p′ (cid:34) ak p′   198 the second term contains the gradient of the powers of the frequency in the denominator ∇bM Akb (cid:104) = (cid:90) 2 (cid:105) dVp′ δ c ν + ucp′ ucp′ ( (cid:0) − c)k  (cid:1)  ak p′   p′ bf(ν′) (k − 1)p′ c∇buc , (cid:2) (cid:3) Ak (cid:89)ak∈ and the final term contains the gradient of the distribution function ∇bM Akb (cid:104) = (cid:90) 3 (cid:105) dVp′ c ν + ucp′ c)k ucp′ δ ( (cid:0) − 1  (cid:1) −  Ak (cid:89)ak∈ p′ b∇bf(ν′). ak p′   (D.4) (D.5) The goal is to rewrite each of these in terms of various ranks of the moment expansion in Eq. (D.1). For the first term, integrating by parts allows writing Eq. (D.3) as ∇buc − = − ∇buc (cid:90) (cid:90) dV ′p   dV ′p   Ak (cid:89)ak∈ Ak (cid:89)ak∈ ak p′ ak p′     ( p′ bp′ cf(ν′) c)k (cid:34) ucp′ − cf(ν′) bp′ p′ c)k (cid:34) ucp′ ( − ∂ c ucp′ − (cid:0) ∂ − (cid:2)(cid:0) c (cid:1) ucp′ ∂( (cid:1) − c δ ∂( (cid:0) ν + ucp′ c) ucp′ − (cid:2) (cid:1)(cid:3) (cid:35) ν + ucp′ c) δ ucp′ (cid:0) c , (cid:1)(cid:3) (cid:35) (D.6) where the additional derivative term of the form ∂ c ucp′ − ∂ c ucp′ − goes to zero un- der integration is suppressed in the final result. Next, applying the δ-function identity (cid:0) (cid:1)(cid:14) (cid:0) (cid:1) ∂y[yδ(x y)] = − ∂x[xδ(x − − y)] allows further simplification of Eq. (D.6) into the form ∇buc (cid:90) ∂ ∂ν  ν∇buc Ak (cid:89)ak∈ dV ′p   dV ′p   . (cid:90)  νM Akbc∇buc ∂ ∂ν (cid:16) (cid:17) = = p′ bp′ cf(ν′) c)k (cid:34) ucp′ ∂ νδ (cid:2) (cid:0) c ν + ucp′ ∂ν (cid:1)(cid:3) (cid:35) ak p′ ( −   bp′ p′ c ak p′   Ak (cid:89)ak∈ δ ν + ucp′ (cid:0) ( ucp′ − c f(ν′) c)k (cid:1)   (D.7) For the next term, pulling momentum-independent quantities outside of the integral 199 allows Eq. (D.4) to be written as (k − 1)∇buc (cid:90) δ dVp′ c ν + ucp′ ucp′ ( (cid:0) − c)k  (cid:1)  ak p′   Ak (cid:89)ak∈ bp′ p′ cf(ν′) = (k − 1)M Akbc∇buc. (D.8) The final term involves the covariant derivative of the distribution function, which reduces to a simple partial derivative since f(ν′) is a scalar function. As the moment expansion is valid only for specific values of the frequency ν, the Boltzmann equation in Eq. (3.6) at a fixed momentum-coordinate can be used to further simplify Eq. (D.5) b p′ ∂f(ν′) ∂xb b p′ c ucp′ b p′ − (cid:0) df dt (cid:1) (cid:20) (cid:21)coll. δ δ δ ν + ucp′ c)k ucp′ ( (cid:0) − ν + ucp′ c)k ucp′ ( (cid:0) − ν + ucp′ c)k ucp′ ( (cid:0) − c c c 1  (cid:1) −  1  (cid:1) −  2  (cid:1) −  Ak (cid:89)ak∈ Ak (cid:89)ak∈ Ak (cid:89)ak∈ dVp′ dVp′ dVp′ (cid:90) (cid:90) (cid:90) = = = SAk .     ak p′ ak p′ ak p′ (cid:20)   df dt (cid:21)coll. (D.9) Collecting these results together shows that the evolution equation for an arbitrary-rank of the moment expansion is ∇bM Akb ∂ ∂ν − νM Akbc∇buc (cid:16) (cid:17) (k − − 1)M Akbc∇buc = SAk . (D.10) D.2. Eulerian Projection of the Second-Rank Moment The radiation energy and momentum density equations, Eqns. (3.39)–(3.40), are obtained from taking the Eulerian projection of the second-rank moment evolution in Eq. (3.21). 200 The radiation energy density equation results from projecting Eq. (3.21) along the Eulerian observer’s four-velocity na na∇bM ab ∂ ∂ν − (cid:16) νnaM abc∇buc = naSa. (D.11) (cid:17) The final two terms in Eq. (D.11) are already in the form of those in the evolution equations, so the first step is to expand the covariant divergence in the first term as na∇bM ab = ∇b naM ab (cid:16) M ab∇bna. − (cid:17) Taking the projection of Eq. (3.32) along na naM ab = Enb − − F b, and using Eq. (C.11), the first term in Eq. (D.12) becomes (D.12) (D.13) ∇b naM ab (cid:16) (cid:17) = = = − − − ∇b Enb + F b (cid:16) 1 α√γ 1 α√γ ∂ ∂xb ∂ ∂t (cid:104) [√γE] (cid:17) α√γ Enb + F b (cid:16) − 1 α√γ ∂ ∂xj (cid:17)(cid:105) √γ αF j (cid:104) (cid:16) − βjE . (cid:17)(cid:105) (D.14) Making use of Eq. (C.7), the second term in Eq. (D.12) is Enanb + F anb + F bna + P ab Kab + M ab∇bna = − (cid:16) = P ijKij − (cid:17)(cid:18) F a ∂ ln α ∂xa . 201 ∂ ln α ∂xa (cid:19) (D.15) Combining Eqns. (D.14)–(D.15) in Eq. (D.12) and using the result for the first term of Eq. (D.11) yields the radiation energy density evolution equation ∂ ˜E ∂t + ∂ ∂xj α ˜F j − (cid:16) = α + ˜Eβj ∂ ∂ν (cid:17) ˜P ijKij − (cid:18) ναna ˜M abc∇buc (cid:16) ˜F i ∂ ln α na ˜Sa ∂xi − (cid:17) , (cid:19) (D.16) where the tilde-quantities are once again the densitized moments, e.g., ˜E = √γE. The radiation momentum density evolution equation results from the spacelike projection of Eq. (3.21) γia∇bM ab ∂ ∂ν − (cid:16) νγiaM abc∇buc = γiaSa. (D.17) (cid:17) In a similar manner as the timelike projections, the first term in Eq. (D.17) can be written as γia∇bM ab = ∇b γiaM ab (cid:16) M ab∇bγia. − (cid:17) (D.18) Taking the spacelike projection of Eq. (3.32) γiaM ab = Finb + P b i , (D.19) and using Eq. (C.11), the first term of Eq. (D.18) becomes ∇b γiaM ab = ∇b Finb + P b i (cid:16) (cid:17) = (cid:16) 1 α√γ ∂ ∂xb (cid:17) Finb + P b i α√γ (cid:104) (cid:16) − (cid:17)(cid:105) 202 Γc ibFcnb Γc ibP b c . − (D.20) The first term of Eq. (D.20) is then 1 α√γ ∂ ∂xb α√γ Finb + P b i (cid:104) (cid:16) (cid:17)(cid:105) = 1 α√γ ∂ ∂t [√γFk] + 1 α√γ ∂ ∂xj √γ αP j (cid:16) i − (cid:104) Fiβj . (D.21) (cid:17)(cid:105) Using Eq. (C.3), Eq. (C.7), and Eq. (C.10), the second term of Eq. (D.20) becomes Γc ibFcnb = − = − − Fc FcΓc binb gcd∇ind − Fj α ∂βj ∂xi . (cid:18) F d∇ind − Fj α − = F jKij − = ∂nc ∂xi ∂βj ∂xi (cid:19) Using Eq. (C.12) and noting that gij = γij, the third term in Eq. (D.20) becomes Γc − ibP b c = − = = − − 1 2 1 2 1 2 P b c gcd (cid:18) ∂γjk ∂xi + P jk (cid:18) P jk ∂γjk ∂xi , ∂gbd ∂xi + ∂gid ∂xb − ∂gib ∂xd (cid:19) ∂γik ∂xj − ∂γij ∂xk (cid:19) (D.22) (D.23) where the final two terms cancel under contraction due the symmetry of P jk. Finally, using Eqns. (C.6)–(C.7) and Eq. (3.32), the second term in Eq. (D.18) becomes M ab∇bγia = − − (cid:16) Enanb + F anb + F bna + P ab (∇bgia + ni∇bna + na∇bni) = Enb∇bni + F b∇bni = E ∂ ln α ∂xi − F jKij. (cid:17) 203 (D.24) In total, using Eqns. (D.18)–(D.24) in Eq. (D.17) gives the final form of the momentum density equation ∂ ∂ ˜Fi + ∂ ∂xj α ˜P j ˜Fiβj − i − ˜P jk ∂γjk (cid:17) ∂xi + Fj ∂ ∂ν (cid:16) ∂βj ∂xi − (cid:16) = α 2 ναγia ˜M abc∇buc (cid:17) ∂α ∂xi + γiaSa. E (D.25) D.3. Eulerian Projection of Frequency-Space Advection The core of the frequency advection term involves the contraction of the third-rank moment expansion of the distribution function (k = 2 in Eq. (3.7)) and the covariant derivative of the co-moving observer’s four-velocity. While both of these quantities are most easily defined in the co-moving frame, it is much easier to evaluate this term using their Eulerian projections. Making use of Eq. (3.69), the resulting contraction takes the form M abc∇buc = Qnanbnc + Ranbnc + Rbnanc + Rcnanb (cid:104) + Sabnc + Sacnb + Sbcna + T abc W ∇bnc + nc × (cid:20) ∂W ∂xb + ∇b(W vc) (cid:21) . (cid:105) (D.26) Using Eqns. (C.5)–(C.6) and Eq. (C.9), the first term of Eq. (D.26) becomes Qnanbnc W ∇bnc + nc (cid:20) ∂W ∂xb + ∇b(W vc) (cid:21) = Qna = Qna (cid:20) nb ∂W ∂xb − nb ∂W − nb ∂W ∂xb (cid:20) ∂xb − (cid:20) Qna + nbnc∇bW vc (cid:21) W nbvc∇bnc + W vk ∂ ln α ∂xk (cid:21) , (cid:21) (D.27) = − 204 from which the second term of Eq. (D.26) can be found in the same exact manner as Ranbnc W ∇bnc + nc (cid:20) ∂W ∂xb + ∇b(W vc) (cid:21) Ra = − (cid:20) nb ∂W ∂xb + W vk ∂ ln α ∂xk . (cid:21) (D.28) Using Eq. (C.5), Eq. (C.7) and Eq. (C.9), the third term of Eq. (D.26) becomes Rbnanc W ∇bnc + nc (cid:20) ∂W ∂xb + ∇b(W vc) (cid:21) = naRi ∂W ∂W ∂xi + nc∇i(W vc) ∂xi + W vj∇i (cid:0) W vjKij ∂W ∂xi − nj , (cid:21) (cid:21) (cid:1) (cid:21) (D.29) − (cid:20) naRi naRi (cid:20) (cid:20) = = − − from which the fifth term in Eq. (D.26) follows as Sabnc W ∇bnc + nc (cid:20) ∂W ∂xb + ∇b(W vc) = (cid:21) ∂W ∂xi − Sai − (cid:20) W vjKij . (cid:21) (D.30) Using Eqns. (C.5)–(C.6) and Eqns. (C.9)–(C.10), the fourth term in Eq. (D.26) is Rcnanb W ∇bnc + nc ∂W ∂xb + ∇b(W vc) (cid:21) (cid:21) ∂ ln α ∂ ln α ∂xb ∂xi + gicnb∇n(W vc) ∂xi + γijnb ∂W vj ∂xi + γijnb ∂W vj ∂xi + γijnb ∂W vj ∂xb − ∂xb ∂ ln α ∂ ln α (cid:20) = naRi = naRi = naRi = naRi W (cid:20) W (cid:34) W (cid:34) W (cid:34) + gicW vdΓc dbnb (cid:35) + gicW vd ∇dnc (cid:18) − ∂nc ∂xd (cid:19)(cid:35) W vjKij + γij W vk α ∂βj ∂xk (cid:35) , (D.31) 205 from which the sixth term in Eq. (D.26) can be found as Sacnb W ∇bnc + nc ∂W ∂xb + ∇b(W vc) (cid:21) (cid:20) = Sai W (cid:34) ∂ ln α ∂xi + γijnb ∂W vj ∂xb − W vjKij + γij W vk α ∂βj ∂xk (cid:35) . (D.32) Using Eq. (C.7) and Eq. (C.12), the seventh term in Eq. (D.26) is Sbcna W ∇bnc + nc ∂W ∂xb + ∇b(W vc) (cid:21) W vk (cid:20) = naSij = naSij W ∇jni + γik∇j (cid:104) W Kij + γik (cid:34)− = naSij W Kij + γik (cid:34)− (cid:16) ∂W vk ∂xj + ∂W vk ∂xj + (cid:17)(cid:105) W vk 2 W vk 2 ∂γij ∂xk (cid:18) ∂γij ∂xk (cid:35) + ∂γik ∂xj − ∂γjk ∂xi (cid:19)(cid:35) , (D.33) where the last line follows from Sij = Sji. Finally, the last term in Eq. (D.26) can be found in the same manner as Eq. (D.33) as T abc W ∇bnc + nc (cid:20) ∂W ∂xb + ∇b(W vc) (cid:21) = T aij W Kij + γik (cid:34)− ∂W vk ∂xj + W vk 2 ∂γij ∂xk (cid:35) . (D.34) In full, using Eqns. (D.27)–(D.34) in Eq. (D.26) give M abc∇buc = nb ∂W ∂xb (cid:20) − + W vk ∂ ln α ∂xk (cid:21) (naQ + Ra) ∂W ∂xi − W ∂ ln α ∂xi − − (cid:34) γijnb ∂W vj ∂xb − W Kij − γik − (cid:34) ∂W vk ∂xj − W vk 2 ∂γij ∂xk (cid:35) 206 γij W vk α ∂βj ∂xk (cid:35) (cid:16) naSij + T aij naRi + Sai (cid:17) . (D.35) (cid:16) (cid:17) APPENDIX E. Practical Expressions for the Fluid Frame Projections Many calculations associated with solving the projected evolution equations require express- ing the co-moving frame projections for the energy density J and momentum density Ha in terms of the evolved Eulerian frame projections E and F a. While these quantities can be interpolated via the closure relation in a similar manner as the pressure tensor, a more efficient approach is to collect the terms common to both limiting forms in addition to those specific to each limit. This appendix will present the expressions for these terms in forms aptly suited for numerical computation, using a notation similar to the ones in Radice et al. (2022); Cheong et al. (2023). To begin, the second-rank moment expansion in the Eulerian frame is written in terms of the closure-interpolated pressure tensor as M ab = Enanb + F anb + F bna + dthinP ab thin + dthickP ab thick = M ab 0 + dthinM ab thin + dthickM ab thick (E.1) where each M ab represents the common terms (zero-subscript) and optically thin and thick terms, and the dthin and dthick are the interpolation coefficients dthin = 3χ(ξ) 2 1 , − dthick = 3[1 χ(ξ)] − 2 , (E.2) such that dthin + dthick = 1. Projecting Eq. (E.1) via Eqns. (3.27)–(3.28) allows writing the co-moving frame projections in the form J = B0 + dthinBthin + dthickBthick, (E.3) 207 Ha = Aa 0 + dthinAa thin + dthickAa thick. For the energy density, the projected coefficients follow from Eq. (3.27) as 2viF i 2 , (cid:17) − ˆf i , B0 = W 2 E (cid:16) Bthin = W 2E (cid:16) W 2 1 − 2W 2 + 1 Bthick = vi (cid:17) 3 (cid:104)(cid:16) − 2W 2 E + 4W 2viF i . (cid:17) (cid:105) (E.4) (E.5) (E.6) (E.7) The momentum density is obtained similarly by projecting each term in Eq. (E.1) via Eq. (3.28) Aa 0 = An 0 na + Av 0va + AF 0 F a, Aa thin = An thinna + Av thinva + AF thinF a, Aa thick = An thickna + Av thickva + AF thickF a, For the common terms shared by both limits, the coefficients are E + vkF k , (cid:17) An 0 = Av 0 = W B (cid:16) W B, − − − AF 0 = W. For the optically thin terms, the coefficients are An thin = W Bthin, − 208 (E.8) (E.9) (E.10) (E.11) (E.12) (E.13) (E.14) Av thin = AF thin = − − W Bthin, W E F ˆf k. vk Finally, the optically thick coefficients are An thick = W Bthick, − Av thick = AF thick = where v2 = γijvivj. Bthick + W − (cid:18) W v2, − 2W 2 3 2W 2 + 1 − E + 2W 2 1 2W 2 + 1 − vkF k , (cid:19) (E.15) (E.16) (E.17) (E.18) (E.19) The higher-rank projected co-moving frame moments follow directly from performing the closure interpolation between the optically thin and thick limiting forms. For the second- and third-rank projections, these interpolations take the form (E.20) (E.21) Lab = dthinLab thin + dthickLab thick, N abc = dthinN abc thin + dthickN abc thick. 209 APPENDIX F. Neutrino-Matter Interation Source Term Jacobian For the neutrino-matter interaction source terms in Eq. (3.107), the included interactions do not couple the neutrino species nor frequencies to each other. This leads to a block-diagonal matrix equation for the implicit update of these stiff terms, allowing each block corresponding to a single neutrino species and frequency to be updated independently. In the following, all radiation quantities are assumed to be frequency-dependent, but the explicit ν-subscript will be suppressed for readability. For this case, the Jacobian of the interaction source terms required for the implicit update is na ∂Sa ∂E ∂Si ∂E ∂S ∂U − = α     ∂Sa ∂Fj na − ∂Si ∂Fj  .     Using Eqns. (3.100)–(3.101), the elements of the Jacobian are na − na − ∂Sa ∂E ∂Sa ∂Fj ∂Si ∂E ∂Si ∂Fj = = = = W κabs. − W κabs. − W κabs. − W κabs. − ∂J ∂E ∂J ∂Fj ∂J ∂E ∂J ∂Fj + (κabs. + κiso.)na + (κabs. + κiso.)na vi − vi − (κabs. + κiso.) (κabs. + κiso.) , ∂Ha ∂E ∂Ha ∂Fj ∂ ¯Hi , ∂E ∂ ¯Hi ∂Fj , (F.1) (F.2) (F.3) (F.4) (F.5) , where ¯Hi = γiaHa. For each of the co-moving frame quantities, these derivatives can be written in terms of the closure interpolation as ∂J ∂E ∂J ∂Fj = = ∂B ∂E ∂B ∂Fj + dthin + dthick + dthin + dthick , ∂Bthick ∂E ∂Bthick ∂Fj ∂Bthin ∂E ∂Bthin ∂Fj 210 , (F.6) (F.7) and na na ∂Ha ∂E ∂Ha ∂Fj ∂ ¯Hi ∂E ∂ ¯Hi ∂Fj = na = na ∂Aa ∂E ∂Aa ∂Fj + dthin na (cid:18) + dthin na thin ∂Aa ∂E ∂Aa thin ∂Fj (cid:19) (cid:19) = = ∂ ¯Ai ∂E ∂ ¯Ai ∂Fj + dthin + dthin (cid:18) ∂ ¯Ai,thin (cid:32) ∂E (cid:33) ∂ ¯Ai,thin (cid:32) ∂Fj (cid:33) + dthick na (cid:18) + dthick na , (cid:19) ∂Aa thick ∂E ∂Aa thick , ∂Fj (cid:19) (cid:18) ∂ ¯Ai,thick (cid:32) ∂E (cid:33) + dthick , (F.10) + dthick ∂ ¯Ai,thick (cid:32) ∂Fj (cid:33) . (F.11) (F.8) (F.9) Using Eqns. (E.5)–(E.7), the terms in the derivatives of the co-moving frame energy density are and ∂B ∂E ∂Bthin ∂E ∂Bthick ∂E = W 2, = W 2 ˆf k vk 2 , (cid:16) W 2 1 (cid:17) 3 − − 2W 2 + 1 (cid:1)(cid:0) = (cid:0) 2W 2 , (cid:1) ∂B ∂Fj ∂Bthin ∂Fj ∂Bthick ∂Fj = = = 2W 2vj, ˆf k − 2W 2Evk vj F (cid:104) W 2 1 − 2W 2 + 1 4W 2 (cid:0) vj. (cid:1) − ˆf k vk ˆf j , (cid:16) (cid:17) (cid:105) (F.12) (F.13) (F.14) (F.15) (F.16) (F.17) For the co-moving frame momentum density, instead of considering the derivatives of Ha with respect to E and Fj directly, it will be simpler to consider the timelike and spacelike projections separately. Using Eqns. (E.8)–(E.10), the derivatives of the timelike projections 211 are na ∂Aa ∂E na na thin ∂Aa ∂E ∂Aa thick ∂E ∂Aa ∂Fj na na thin ∂Aa ∂Fj na ∂Aa thick ∂Fj = W = W = W = W = W = W , 1 (cid:19) , + vj , (cid:19) , ∂B ∂E − (cid:18) ∂Bthin ∂E ∂Bthick ∂E ∂B ∂Fj (cid:18) ∂Bthin ∂Fj ∂Bthick ∂Fj , . Similarly, the derivatives of the spacelike projections are ∂ ¯Ai ∂E ∂ ¯Ai,thin ∂E ∂ ¯Ai,thick ∂E ∂ ¯Ai ∂Fj ∂ ¯Ai,thin ∂Fj ∂ ¯Ai,thick ∂Fj = W − (cid:18) = W − = W − = W − = W − = W − (cid:20)(cid:18) (cid:20)(cid:18) (cid:20)(cid:18) (cid:20)(cid:18) (cid:20)(cid:18) vi, ∂B ∂E (cid:19) ∂Bthin ∂E (cid:19) ∂Bthick ∂E ∂B ∂Fj (cid:19) ∂Bthin ∂Fj (cid:19) ∂Bthick ∂Fj (cid:19) vi + ˆf k vk ˆfi , (cid:17) (cid:16) 2W 2 3 − 2W 2 + 1 + (cid:21) vi, (cid:21) (cid:19) vi + γj i , (cid:21) vj vi + − (cid:16) 2W 2 1 vi + 2W 2 + 1 − 2vk ˆf k ˆf j ˆfi + vk ˆf kγj i (cid:17) vivj + 1 W 2 W 2 γj − i (cid:21) (F.18) (F.19) (F.20) (F.21) (F.22) (F.23) (F.24) (F.25) (F.26) (F.27) (F.28) (F.29) , (cid:21) . 212 APPENDIX G. Time-Integration Tableau The method-of-lines (MoL) time-integrators in Flash-X can easily be extended with new Butcher tableaus. Each of the three types of integrators, explicit Runge-Kutta (ERK), implicit-explicit (IMEX), and multi-rate (MR), contain a tableau directory. To add a new method, a new subdirectory with the name of the method must be created in this directory, e.g., tableau/rk4 for the classic fourth-order Runge-Kutta method. This subdirectory must contain a Flash-X Config file that defines the number of stages and the order of the method, as well as the required number of intermediate states to be stored; see code snippet G.2 for an example Config file. Each method must also provide an implementation for the integrator- specific subroutine that sets the values in the tableau. An example for the RK4 method in the ERK integrator is provided in code snippet G.1. The remainder of this appendix lists the currently available methods in Flash-X. subroutine ta_molERKInitTableau() use ta_molERKData, only: ta_molERK_tableau, ta_molERK_A, ta_molERK_b, ta_molERK_c implicit none ! Name of the method ta_molERK_tableau = "rk4" ! Set the values of the matrix A ta_molERK_A = 0.0 ta_molERK_A(2, 1) = 1.0/2.0 ta_molERK_A(3, 2) = 1.0/2.0 ta_molERK_A(4, 3) = 1.0 ! Set the values of the b and c vectors ta_molERK_b(:) = [1.0/6.0, 1.0/3.0, 1.0/3.0, 1.0/6.0] ta_molERK_c(:) = [0.0, 1.0/2.0, 1.0/2.0, 1.0] end subroutine ta_molERKInitTableau Code Snippet G.1: Example subroutine for the ERK RK4 integration method. 213 # tableau/rk4/Config # Number of intermediate states to store NRHS 4 # Pre-processor defines for order and number of stages PPDEFINE MOL ORDER 4 PPDEFINE MOL NSTAGES 4 Code Snippet G.2: Example Config file for the RK4 integration method. G.1. Explicit Methods Currently, there are four explicit methods available in the ERK time-integrator, one each for first- through fourth-order. The first-order forward Euler method and the fourth-order classic RK4 method can be found in any standard reference on finite-difference methods for initial value problems, such as LeVeque (2007). The second- and third-order methods are based on the strong stability preserving (SSP) methods in Shu & Osher (1988). Tables G.1–G.4 present these methods in the form of the tableau in Eq. (6.3). 0 0 1 Table G.1: First-order single-stage forward Euler method 0 1 0 1 0 0 1/2 1/2 Table G.2: Second-order two-stage Heun’s SSP RK2 method 214 0 1 0 1 0 0 1/2 1/4 1/4 0 0 0 1/6 1/6 2/3 Table G.3: Third-order three-stage SSP RK3 method 0 0 1/2 1/2 0 0 1/2 1 0 0 1/2 0 0 0 0 1 0 0 0 0 1/6 1/3 1/3 1/6 Table G.4: Fourth-order four-stage classic RK4 method G.2. Implicit-Explicit Methods The currently available IMEX methods are all based on the additive Runge-Kutta (ARK) IMEX methods in Ascher et al. (1997). All methods will be designated by the triplet (s, σ, p), where s is the number of implicit stages, σ is the number of explicit stages, and p is the order of the method. Tables G.5–G.12 present these methods in the form of the combined tableaus in Eq. (6.5); the implicit and explicit tableaus will be on the left and right, respectively. 0 1 0 0 0 0 1 1 0 1 1 0 0 0 Table G.5: ARK(1,1,1) 215 0 1 0 0 0 0 1 1 0 1 0 0 0 1 Table G.6: ARK(1,2,1) 0 1/2 0 0 0 0 0 1/2 1/2 1 0 0 0 1 Table G.7: ARK(1,2,2) 0 γ 1 0 0 0 0 0 γ γ γ 1 1 − − 0 0 γ γ 0 γ δ δ 0 0 1 1 δ δ − − 0 0 0 0 Table G.8: ARK(2,2,2); γ = 2 √2 /2 and δ = 1 1/(2γ) − − (cid:0) (cid:1) 0 γ 1 0 0 0 0 0 γ γ γ 1 1 − − 0 0 γ γ Table G.9: ARK(2,3,2); γ = 2 0 γ δ 0 − 0 0 1 1 δ γ − − 0 0 0 γ √2 /2 and δ = 2√2/3 − (cid:0) (cid:1) 216 0 γ γ 1 − 0 0 0 0 0 γ 2γ 1 − 0 0 γ 1/2 1/2 0 γ − 0 γ 0 0 1 2(1 γ) − 0 0 0 1/2 1/2 Table G.10: ARK(2,3,3); γ = 3 + √3 /6 0 η 1+η 2 1 0 0 0 0 0 0 η 1 η − 2 b2 b2 0 0 η b3 b3 0 0 0 η η (cid:0) 0 0 0 η a3,1 a3,2 (cid:1) 0 0 0 0 0 0 2α 1 − 0 α b2 α 0 b3 η Table G.11: ARK(3,4,3); see Eqns. (G.1)–(G.5) for the coefficients. The coefficients in table G.11 use a notation similar to this method’s presentation in Chinomona & Reynolds (2021) (this method serves as the base of their third-order multi- rate IMEX methods), and are given by η = 0.4358665215084589994160194511935568425293, α = 0.5529291480359398193611887297385924764949, a3,1 = α (cid:18) 15 4 − 15 4 a3,2 = α + 15η − (cid:18) 3 2 − b2 = η2 + 4η − 15η + 21 4 η2 7 2 − + 13η η2, 9 2 − (cid:19) η2 (cid:19) b3 = + 4 25 2 − η + η2, 9 2 η2 3 2 − 5η + 5 4 . 21 4 − 1 4 , 217 (G.1) (G.2) (G.3) (G.4) (G.5) 0 1/2 2/3 1/2 1 0 0 0 0 0 0 0 1/2 0 0 1/6 1/2 0 0 0 1/2 1/2 1/2 − 0 0 0 0 0 1/2 0 0 11/18 1/18 0 0 0 5/6 5/6 1/2 − 0 0 0 0 3/2 3/2 3/2 − 3/2 − 1/2 1/2 1/4 7/4 3/4 1/2 1/2 1/4 7/4 3/4 7/4 7/4 − − 0 0 0 0 0 0 Table G.12: ARK(4,4,3) G.3. Multi-Rate Methods Currently, only one method is available in the MR integrator: the IMEX-MRI-GARK3b method from Chinomona & Reynolds (2021). This is a third-order accurate outer “slow” IMEX method; the inner “fast” method can be chosen freely, but only the same four ERK methods in appendix G.1 are currently available in Flash-X. The tableau values are provided to 36 digits of precision in appendix B of Chinomona & Reynolds (2021), and for brevity are not repeated here. Please refer to table G.13 for list of the equivalent quantities to those used in chapter 6. Quantity in Eq. (6.10) Equivalent in CR AI, { k k AE, { } ≡ } ≡ k a I, { ij } a k { E, ij } k γ{ }i,j k ω{ }i,j Table G.13: Difference in notation used here in Eq. (6.10) and in Chinomona & Reynolds (2021) (referred as “CR” in the table above). The fractional offsets into the time-step cS and the final linear combination weights bI,E share a similar notation. 218