Source-linked AI summary
IllinoisGRMHD: An Open-Source, User-Friendly GRMHD Code for Dynamical Spacetimes
Zachariah B. Etienne, Vasileios Paschalidis, Roland Haas, Philipp Moesta, Stuart L. Shapiro
TL;DR
IllinoisGRMHD addresses the challenge of modeling electromagnetic counterparts and the adoption barriers of a proven but expert-oriented GRMHD code. It rewrites OrigGRMHD as an open-source, more user-friendly and modular code; the reported results include roundoff-precision agreement with OrigGRMHD and faster performance than GRHydro.
Problem
Detailed electromagnetic-counterpart models are difficult because relevant flows span many scales and require coupling nonlinear Einstein and GRMHD equations, while OrigGRMHD’s expert-oriented design lacked features supporting community adoption.
Source: §1 · pp. 2–3Method
IllinoisGRMHD is an open-source, ground-up rewrite of OrigGRMHD emphasizing user-friendliness, modularity, robustness, and performance.
Source: §6 · p. 29Results
IllinoisGRMHD is 1.7–1.8 times faster than standard GRHydro in production-size AMR runs and about 16% better than GRHydro-experimental at 1,024–2,048 cores, while reproducing OrigGRMHD to roundoff precision.
Source: §6 · pp. 29–30Takeaways & Limitations
IllinoisGRMHD offers an open-source alternative that retains OrigGRMHD’s roundoff-level results while improving performance over the standard GRHydro version in the reported production runs.
Source: §6 · p. 29The current version supports only single gamma-law equations of state.
Source: §6 · p. 30
Abstract
from arXiv · showhide
In the extreme violence of merger and mass accretion, compact objects like black holes and neutron stars are thought to launch some of the most luminous outbursts of electromagnetic and gravitational wave energy in the Universe. Modeling these systems realistically is a central problem in theoretical astrophysics, but has proven extremely challenging, requiring the development of numerical relativity codes that solve Einstein's equations for the spacetime, coupled to the equations of general relativistic (ideal) magnetohydrodynamics (GRMHD) for the magnetized fluids. Over the past decade, the Illinois Numerical Relativity (ILNR) Group's dynamical spacetime GRMHD code has proven itself as a robust and reliable tool for theoretical modeling of such GRMHD phenomena. However, the code was written "by experts and for experts" of the code, with a steep learning curve that would severely hinder community adoption if it were open-sourced. Here we present IllinoisGRMHD, which is an open-source, highly-extensible rewrite of the original closed-source GRMHD code of the ILNR Group. Reducing the learning curve was the primary focus of this rewrite, with the goal of facilitating community involvement in the code's use and development, as well as the minimization of human effort in generating new science. IllinoisGRMHD also saves computer time, generating roundoff-precision identical output to the original code on adaptive-mesh grids, but nearly twice as fast at scales of hundreds to thousands of cores.
1. Introduction & Motivation
IllinoisGRMHD rewrites a proven but expert-oriented dynamical-spacetime GRMHD code to lower barriers to community adoption. The section motivates this work with the difficulty of modeling electromagnetic counterparts and reports validation against OrigGRMHD and GRHydro.
- Without detailed electromagnetic-counterpart models, interpreting observed counterparts may be limited; constructing such models requires resolving many length and time scales and coupling nonlinear Einstein and GRMHD equations.Source: §1 · p. 2
- OrigGRMHD’s vector-potential AMR formulation preserves the no-monopoles constraint across refinement boundaries, supporting modeling of multi-scale magnetized flows.Source: §1 · p. 2
- The community could benefit from consolidating development around a shared dynamical-spacetime GRMHD code, while GRHydro’s AMR monopole issue and reliance on black-hole excision have limited its broader use.Source: §1 · pp. 3–4
- Despite OrigGRMHD’s track record, its limited documentation, modularity, coding consistency, and maintenance hindered community adoption, prompting a ground-up rewrite guided by four design principles.Source: §1 · p. 3
- Validation tests show IllinoisGRMHD reproduces OrigGRMHD, matches or improves its performance and scalability relative to OrigGRMHD and GRHydro, and agrees quantitatively with GRHydro in dynamical-spacetime TOV-star evolutions.Source: §1 · p. 4
2. Basic Equations
IllinoisGRMHD evolves Einstein gravity coupled to ideal-MHD matter under perfect-fluid and infinite-conductivity assumptions. Its formulation combines conservative shock-capturing evolution, vector-potential magnetic-field evolution, and specified outer-boundary conditions.
2. Basic Equations
- IllinoisGRMHD couples Einstein gravity to ideal-MHD matter, assuming a perfect-fluid stress-energy tensor and infinite conductivity, with GRMHD quantities sourcing Einstein’s equations.Source: §2 · p. 5
- For numerical evolution, the spacetime is split into ADM 3+1 form and evolved with BSSN, a formulation chosen for stable, long-term, accurate integration.Source: §2 · pp. 5–6
- The GRMHD equations use conservative form with high-resolution shock capturing, conserving rest mass to roundoff without source terms and satisfying shock jump conditions.Source: §2 · pp. 6–7
- Directly discretizing the induction equation can violate the divergence-free magnetic-field constraint, especially on AMR grids; evolving the vector potential preserves it to roundoff error.Source: §2 · p. 7
- The hybrid equation of state combines cold and thermal components, with Γ_th setting kinetic-to-thermal conversion at shocks; the conservative-to-primitive solver supports only one polytropic index.Source: §2 · p. 8
2.1. Outer Boundary Conditions
- At outer faces, density, pressure, and velocity use copied zero-gradient values, with incoming velocity set to zero to impose outflow conditions.Source: §2.1 · p. 9
3. Basic Algorithms
This section presents IllinoisGRMHD’s streamlined basic algorithms, combining HRSC evolution, vector-potential constrained transport, and stagger-aware scalar-potential evolution. It also covers scalar-potential derivative handling, conservative-to-primitive inversion and safeguards, outer-boundary treatment, and coupling to the Einstein Toolkit.
3. Basic Algorithms
- IllinoisGRMHD removes obsolete and nonrobust functionality, standardizes core algorithms, and replaces duplicated code with a compact library of optimized functions.The retained algorithms are those used in the Illinois group’s latest GRMHD publications.Source: §3 · p. 9
- Conservative-to-primitive recovery uses a Newton-Raphson root-finder to compute primitive variables from updated conservatives, with consistency checks before and after the solver.This recovery restores primitive variables needed for the next iteration or timestep.Source: §3 · pp. 10–11
3.1. Evolution of ρ∗, ˜Si, and ˜τ
- The conservative variables ρ∗, ˜Si, and ˜τ are evolved with a second-order finite-volume HRSC scheme using PPM reconstruction and an HLL approximate Riemann solver.The approximate characteristic speeds can overestimate the maximum by a factor ≤2, increasing dissipation that may smear physical features but helps stabilize evolutions; RK4 is typically chosen to minimize total error in spacetime and fluid evolution.Source: §3.1 · pp. 11–13
3.2. Vector-Potential-Based Constrained Transport Scheme
- Vector-potential constrained transport maintains ∇·B = 0 and yields identical output to standard staggered constrained transport on uniform grids, while allowing any AMR-boundary interpolation scheme if B is computed from interpolated A.Standard constrained transport on AMR requires specially devised, implementation-tuned prolongation and restriction to maintain the divergence constraint at refinement boundaries.Source: §3.2 · p. 13
3.3. Evolution of the densitized EM scalar potential [√γΦ]
- For the densitized electromagnetic scalar potential, IllinoisGRMHD interpolates right-hand-side quantities to consistent staggered points before taking derivatives, rather than applying reconstruction.The shift-advection term is handled by first interpolating the shift to the required staggered point.Source: §3.3 · p. 16
- For the densitized EM scalar-potential derivative, advection uses the metric thorn’s upwinding strategy; Term (3) requires interpolating only α using Term (1)’s strategy.The derivative is evaluated with second-order operators, with corresponding derivatives in the y and z directions following the x-direction procedure.Source: §3.3 · pp. 16–17
3.4. Conservatives-to-Primitives Solver
- IllinoisGRMHD uses a two-dimensional Newton-Raphson solver to recover primitive variables, validating conservatives first and setting pressure to Pcold if the solver rarely fails.Failures occur almost always in a low-density atmosphere or inside a black hole.Source: §3.4 · p. 17
- After inversion, superluminal speeds are reduced to W=10, pressure is floored at 0.9Pcold, and capped at 100Pcold for ρ0<100ρatm or deep inside horizons.Raising the pressure floor to Pcold exactly causes large central density drifts in TOV star evolutions.Source: §3.4 · pp. 17–18
3.5. Outer Boundary Conditions for Ai, [√γΦ], P, ρ0, and vi
- Each RK4 iteration uses three ghost zones; vector potentials receive linear-extrapolation boundaries, while hydrodynamic variables use zero-derivative outflow boundaries.With xy-plane symmetry, the negative-z outer condition is omitted so Cactus/Carpet can impose reflection symmetry.Source: §3.5 · p. 18
3.6. Linkage of IllinoisGRMHD to the Rest of the Einstein Toolkit
- Through TmunuBase, IllinoisGRMHD is compatible with Einstein Toolkit spacetime formulations coupled to ADMBase, including BSSN and conformal and covariant Z4 [1].The paper’s dynamical-spacetime evolutions couple IllinoisGRMHD to the McLachlan BSSN thorn [15].Source: §3.6 · pp. 18–19
4. Code Validation Tests
The validation tests compare IllinoisGRMHD with its predecessor, OrigGRMHD, and with GRHydro. They report roundoff-level agreement with OrigGRMHD and convergence behavior consistent with GRHydro, with some differences in constraint violations and density drift.
4.1. IllinoisGRMHD and OrigGRMHD: Roundoff-Error Agreement in Evolving Magnetized TOV Star
- On AMR grids, IllinoisGRMHD and OrigGRMHD track the same roundoff-error curve when evolving a weakly magnetized TOV star.The test compares their agreement with the expected roundoff error from a 15th-significant-digit perturbation.Source: §4.1 · p. 20, Figure 1 · p. 21
4.2. IllinoisGRMHD and OrigGRMHD: Roundoff-Error Agreement in Evolving Random Initial Data
- The random-data test uses discontinuous, stochastic GRMHD flows and spacetime fields, while holding the spacetime fixed rather than evolving Einstein's equations.The setup was designed as a numerical stress test and is not intended to satisfy Einstein's equations.Source: §4.2 · p. 20
- In that harsh random-data test, IllinoisGRMHD and OrigGRMHD agree within expected roundoff error for at least 25 light-crossing times.The OrigGRMHD perturbation baseline plateaus at about 13 digits of agreement.Source: §4.2 · p. 21, Figure 2 · p. 22
4.3. IllinoisGRMHD and GRHydro: Unmagnetized TOV Star Convergence Tests
- The GRHydro comparison uses identical initial data, grids, spacetime evolution, reconstruction, and Riemann-solver choices, making it a proxy comparison with OrigGRMHD.Both codes use the same basic algorithms in this test but differ in implementation.Source: §4 · p. 19, §4.3 · p. 23
- Both codes' central-density drift and Hamiltonian constraint violations converge to zero at roughly second order, while GRHydro's constraint-convergence order fluctuates more.At the highest resolution, GRHydro has roughly 8% higher Hamiltonian constraint violation than IllinoisGRMHD.Source: §4.3 · p. 23, Figure 3 · p. 24
- For the unmagnetized TOV test, IllinoisGRMHD's absolute central-density drift is higher, but the fitted drift rates are within about one standard deviation.The fits use data from 5 to 55 dynamical timescales; doubling the outer boundary had no qualitative effect.Source: §4.3 · pp. 23–24, Figure 4 · p. 25
5. Performance Benchmarks
IllinoisGRMHD's rewrite was designed for usability, extensibility, and performance while preserving roundoff-level agreement with OrigGRMHD. On the tested Stampede AMR workloads, it outperforms standard GRHydro and OrigGRMHD, with performance comparable to experimental GRHydro.
5. Performance Benchmarks
- IllinoisGRMHD's staggered vector-potential formulation costs about 60% more for flux reconstructions, but prevents monopoles from being generated at AMR boundaries.The cited comparison says GRHydro's AMR scheme cannot guarantee this constraint.Source: §5 · pp. 25–26
- IllinoisGRMHD outperforms OrigGRMHD by 1.3× at 32 cores and 1.6× at 256 and 2,048 cores.Independent tests attribute about 10–20% of the performance difference to OrigGRMHD's older Cactus/Carpet infrastructure.Source: §5 · p. 26
- The benchmarks project a 1.6–1.8× computational-resource boost for groups adopting IllinoisGRMHD from standard GRHydro or OrigGRMHD.Independent tests indicate a performance gap of about 2× for fixed-spacetime-background GRMHD simulations.Source: §5 · p. 26
- Across 32–2,048 cores, IllinoisGRMHD delivers 1.7–1.8× standard GRHydro's per-core throughput, and is about 16% faster than GRHydro-experimental at 2,048 cores.At 32 cores, IllinoisGRMHD and GRHydro-experimental are within measurement error.Source: §5 · p. 26, Figure 5 · p. 27
- For a typical production run, IllinoisGRMHD's OpenMP/MPI hybrid is slightly more than 40% faster than pure MPI.OpenMP reduces network load by allowing fewer MPI processes and larger grids per process.Source: §5 · p. 27
6. Conclusions and Future Work
IllinoisGRMHD is a ground-up rewrite designed for user-friendliness, extensibility, robustness, and performance. It reproduces OrigGRMHD at roundoff precision, compares favorably in performance, and supports multi-scale AMR flows while maintaining the no-monopole constraint.
6. Conclusions and Future Work
- IllinoisGRMHD was rewritten to improve user-friendliness and modularity, with documentation, basic programming requirements, and low-level CFD routines separated into an extensible function library.These changes were intended to facilitate community adoption.Source: §6 · p. 29
- IllinoisGRMHD reproduces OrigGRMHD results to roundoff-level precision for magnetized neutron stars and discontinuous random initial data.It was designed as a drop-in replacement for the original code.Source: §6 · p. 29
- IllinoisGRMHD and GRHydro both show approximate second-order convergence, but differ in constraint violations and central-density drift during unmagnetized TOV-star evolution.GRHydro has about 8% higher Hamiltonian constraint violations, while its absolute central-density drift is lower; the drift rates match after initial settling over a few dynamical timescales.Source: §6 · p. 29
- IllinoisGRMHD is 1.7–1.8 times faster than standard GRHydro and about 16% faster than GRHydro-experimental at 1,024 to 2,048 cores.The standard-GRHydro comparison is for production-size, AMR-enabled GRMHD runs on Stampede; the experimental version matches IllinoisGRMHD at best at small core counts.Source: §6 · pp. 29–30
- IllinoisGRMHD enforces the no-monopole constraint on multi-scale AMR flows and can stably evolve flows into black-hole horizons over long timescales without excision.The authors state that GRHydro cannot guarantee the no-monopole constraint at AMR boundaries and requires excision for black-hole flows.Source: §6 · pp. 29–30
- IllinoisGRMHD outperforms OrigGRMHD by a factor of 1.3–1.6.The authors state that adopting IllinoisGRMHD would increase computational resources available for dynamical-spacetime GRMHD runs.Source: §6 · p. 30
- Future work includes comparing algorithmic implementations and extending IllinoisGRMHD with additional solvers, equations of state, and symmetry conditions.The current version supports only single gamma-law equations of state and either no symmetry or bitant symmetry across the xy-plane.Source: §6 · p. 30
Appendix A. Physical and Computational Setup for Unmagnetized TOV Star Convergence Tests
The unmagnetized convergence tests evolve a cold polytropic TOV neutron star with IllinoisGRMHD and GRHydro on nested AMR grids, using matched evolution algorithms and three resolutions.
Appendix A. Physical and Computational Setup for Unmagnetized TOV Star Convergence Tests
- The initial data describe a cold, degenerate TOV neutron star with central density 0.129285309, K = 1, Γ = 2, and compaction MNS/RNS ≈0.1467.The model uses P = Kρ^Γ and is generated with the Einstein Toolkit's built-in TOVSolver thorn.Source: Appendix A · p. 31
- IllinoisGRMHD and GRHydro are coupled to McLachlan BSSN and use matched evolution algorithms, with HLLE and PPM selected for GRHydro.The codes differ in implementation details, including reconstructing internal energy in GRHydro rather than pressure.Source: Appendix A · p. 31
- The tests use four nested refinement cubes and resolve the neutron-star diameter with approximately 51, 64, or 80 gridpoints in low-, medium-, and high-resolution runs.The finest-level grid spacing is ∆x = {0.03906, 0.03125, 0.025}RNS; the atmosphere floor is 10^-7 times the initial central density.Source: Appendix A · p. 31
Appendix B. Physical and Computational Setup for Magnetized TOV Star Code Validation Tests
The magnetized TOV validation tests seed a stable neutron star with a weak poloidal field and compare IllinoisGRMHD with OrigGRMHD on a deliberately coarse AMR grid.
Appendix B. Physical and Computational Setup for Magnetized TOV Star Code Validation Tests
- The magnetized initial data use the same stable neutron star as Appendix A, seeded at t = 0 with a weak, purely poloidal magnetic field.The maximum initial magnetic-to-gas pressure ratio β^-1 is 0.83×10^-3, with Pcut set to 4% of maximum pressure.Source: Appendix B · p. 32
- IllinoisGRMHD and OrigGRMHD are coupled to the Illinois group's closed-source BSSN dynamical-spacetime module for these tests.The initial star density, pressure, and metric profiles come from the code of and agree to machine precision with the unmagnetized-test TOVSolver data.Source: Appendix B · p. 32
- The AMR setup resolves the neutron-star diameter with 26 gridpoints, intentionally using low resolution and a close outer boundary to magnify truncation-error and boundary-condition effects.The finest-grid spacing is ∆x ≈ 0.078RNS; the atmosphere floor is 10^-7 times the initial central density.Source: Appendix B · p. 32
Appendix C. Random Initial Data
The random initial-data module constructs reproducible, strongly perturbed GRMHD and spacetime fields on an AMR grid. The tests enforce a positive-definite spatial metric and the unit-determinant BSSN constraint before evolution.
Appendix C. Random Initial Data
- Each gridpoint receives a double-precision random number ξ ∈ (−0.1, 0.1) from a coordinate-based seed, making data reproducible across processor decompositions on identical grids.The module uses the gridpoint coordinate to generate the seed.Source: Appendix C · p. 32
- The initial prescription sets spacetime and GRMHD quantities from a stochastic perturbation atop a smoothly oscillating function, with remaining quantities computed from the prescribed values.The setup enforces a Lorentzian spacetime metric, a positive-definite three-metric, and the BSSN unit-determinant constraint by rescaling the spatial metric components.Source: Appendix C · p. 33
- The random-data tests use one refinement level and disable spacetime evolution, along with prolongation and restriction operations on spacetime variables.The coarser grid has spacing 1.0 and half-side-length 10; the finer grid has spacing 0.5 and half-side-length 2.Source: Appendix C · p. 33
- During evolution, the Lorentz factor limit W = 10 is exceeded and enforced about 400 times despite initially independent random values at neighboring gridpoints.The initial magnetic-to-gas pressure ratio ranges from approximately 10^-3 to about 10, while density fluctuations span about four orders of magnitude.Source: Appendix C · pp. 33–34