betaFeedback

WorksPhysics and Astronomy

FUGUE: A New GPU-accelerated General Relativistic Magnetohydrodynamics Code with Weak-Field Multipole Self-Gravity and Quasi-Stationary Kerr Black Hole Evolution

Abstract

We present FUGUE, a new GPU-accelerated code for general relativistic magnetohydrodynamics (GRMHD). The code supports an optional quasi-stationary update of the Kerr black hole mass and spin, as well as weak-field multipole self-gravity computed with a spherical harmonic Poisson solver. The calculations using high-order multipoles in the Poisson solver are expensive, so the self-gravity solver is well suited for GPU acceleration. The code uses shock-capturing methods and a second-order Runge–Kutta (RK2) scheme for time integration. We validate the code with hydrodynamic, magnetohydrodynamic, general relativistic, and convergence tests for the self-gravity module. We present an application of the code to a simulation of a self-gravitating, Toomre-unstable, magnetized accretion disk with a mass of 1,M-Sun around a Kerr black hole. In our demonstration model, gravitational instabilities are associated with changes in the mass accretion rate and the Blandford–Znajek luminosity, and may contribute to gamma-ray burst variability.The performance of the code is equivalent to or exceeds that of the current state-of-the-art GRMHD codes, achieving more than 470 million zone-cycles per second on a single NVIDIA GH200 GPU with linear reconstruction.

Introduction

General relativistic magnetohydrodynamic simulations are important tools for studying astrophysical phenomena related to relativistic and highly magnetized plasmas. Numerical studies based on such simulations have led to important results, such as clarifying the nature of magnetorotational instability (MRI) and MRI-driven accretion under strong gravity [24, 12], establishing the SANE (standard and normal evolution)/MAD (magnetically arrested disk) accretion classification [62], or demonstrating that highly efficient jets can be generated during the MAD state [89]. Moreover, the results from GRMHD simulations provided a theoretical basis for analyzing observational data for the first image of a black hole [18]. A comparison of state-of-the-art GRMHD codes showed that for standard test problems, the results are consistent among different codes [70].

Corresponding author: Piotr Płonka

[email protected]

Numerical simulations, especially in three dimensions, are computationally expensive. A way to significantly speed up calculations is the use of GPU accelerators. Therefore, several GPU-accelerated GRMHD codes have been developed. Examples of codes for stationary spacetimes include H-AMR [52], cuHARM [3], KHARMA [72], and ECHO [14], whereas examples of codes that can also work with dynamical spacetimes include AsterX [44], GRaM-X [79], and AthenaK [87].

The motivation behind developing a new code, which, in contrast to fixed-background spacetime codes, takes into account the quasi-stationary evolution of the mass and spin of the black hole, as well as the self-gravity of the fluid in an effective weak-field approximation, is to provide a practical tool for three-dimensional simulations of collapsars and massive self-gravitating accretion disks around spinning black holes. Modern approaches to numerical studies of collapsars, which are progenitors of long gamma-ray bursts (GRBs), are usually based on three-dimensional GRMHD simulations (O. Gottlieb et al. 2022a,b; D. Issa et al. 2025), which take into account neither the self-gravity of the fluid nor the evolution of the black hole mass and spin. The simulations of collapsars in dynamical spacetime are robust; however they are typically limited to axisymmetry [23, 81, 80]. Self-gravity can be particularly important in the accretion disks of collapsars, which can be gravitationally unstable [57, 7, 51]. In the collapsar disk, non-axisymmetric structures may form and become sources of gravitational waves (GWs; [68, 30, 97]). Hydrodynamic asymmetries can also generate early GWs in core-collapse supernovae [11]. Potentially, if the disk is cold enough, self-gravity can amplify non-axisymmetric modes and increase GW emission. An advantage over the post-Newtonian studies of self-gravitating unstable disks, is that with our new code the self-gravity module is built on top of the evolving Kerr metric, so that we can study the effects of disk fragmentation during the launching of relativistic jets driven by the Blandford–Znajek process [4].

Another important application of our code is the study of black hole spin-down and spin-up. In contrast to the previous studies devoted to spin evolution [54, 39, 38, 53], the code evolves the black hole spin directly in the simulation at every time step. Consequently, both the MAD state [61, 89, 60] and the disk respond to the evolving Kerr background spacetime. Thanks to GPU acceleration, we can carry out three-dimensional studies of self-gravitating disks, relativistic jet launching and propagation, and the evolution of black hole spin more efficiently over longer simulation runs.

This article is organized as follows. In Sect. 2 we present the equations of general relativistic magnetohydrodynamics. In Sect. 3, we present the quasi-stationary black hole evolution. In Sect. 4, we explain the implementation of weak-field self-gravity. In Sect. 5 we describe the numerical scheme of the code. In Sect. 6, we present the validation of the code in tests for special relativistic hydrodynamics, magnetohydrodynamics, GRMHD, and self-gravity. We compare our code with state-of-the-art codes. In Sect. 7, we discuss the kernel structure of the GPU code, its performance and scalability tests, the main limitations of our code, and numerical error control. In Sect. 8 we present the application of our code to simulations of self-gravitating, Toomre-unstable disks around a rotating black hole in a Kerr spacetime updated quasi-stationarily. In Sect. 9 we summarize the article and present our conclusions.

General relativistic magnetohydrodynamics

The code solves the covariant equations of ideal magnetohydrodynamics in general relativity, namely the continuity equation, the conservation of energy–momentum, and the induction equation, defined as follows:

∇μ(ρuμ)=0,∇μTμν=0,∇μ(∗Fμν)=0,(1)\nabla_\mu\left(\rho u^\mu\right)=0,\quad\nabla_\mu T^{\mu\nu}=0,\quad\nabla_\mu\left({}^{*}F^{\mu\nu}\right)=0, \tag*{(1)}

where ρ\rho is the rest-mass density, uμu^\mu is the fluid four-velocity, TμνT^{\mu\nu} is the total stress–energy tensor of the magnetized fluid, including both fluid and electromagnetic contributions, and ∗Fμν{}^{*}F^{\mu\nu} is the dual Faraday tensor. The ideal-MHD condition is:

uνFμν=0,(2)u_\nu F^{\mu\nu}=0, \tag*{(2)}

which implies that the electric field vanishes in the comoving frame. Throughout the paper, we use the metric signature (−,+,+,+)(-,+,+,+), geometrized units with G=c=1G=c=1 and Heaviside–Lorentz electromagnetic units. All quantities are expressed in units based on the initial black hole mass. The perfect-fluid contribution to the stress–energy tensor is given by:

Tfluidμν=(ρ+u+p)uμuν+pgμν,(3)T_{\mathrm{fluid}}^{\mu\nu}=(\rho+u+p)u^\mu u^\nu+pg^{\mu\nu}, \tag*{(3)}

where uu is the internal energy per unit volume, pp is the gas pressure, and gμνg^{\mu\nu} is the metric tensor. The code uses an ideal-gas equation of state:

p=(γad−1)u,(4)p=(\gamma_{\mathrm{ad}}-1)u, \tag*{(4)}

where γad\gamma_{\mathrm{ad}} is the adiabatic index. For the electromagnetic field, the stress–energy tensor is given by:

TEMμν=b2uμuν+12b2gμν−bμbν,(5)T_{\mathrm{EM}}^{\mu\nu}=b^2u^\mu u^\nu+\frac{1}{2}b^2g^{\mu\nu}-b^\mu b^\nu, \tag*{(5)}

where bμ≡uν∗Fμνb^\mu\equiv u_\nu{}^{*}F^{\mu\nu} is the magnetic four-vector, and b2=bμbμb^2=b^\mu b_\mu. The magnetic four-vector satisfies uμbμ=0u_\mu b^\mu=0. The total stress-energy tensor is the sum of the fluid and electromagnetic parts Eqs. (3) and (5), given by:

TMHDμν=(ρ+u+p+b2)uμuν+(p+b22)gμν−bμbν.(6)T_{\mathrm{MHD}}^{\mu\nu}=(\rho+u+p+b^2)u^\mu u^\nu+\left(p+\frac{b^2}{2}\right)g^{\mu\nu}-b^\mu b^\nu. \tag*{(6)}

The relation between the coordinate-frame magnetic field Bi≡∗FitB^i\equiv{}^{*}F^{it} and the magnetic four-vector is given by:

bt=giμBiuμ,bi=Bi+btuiut.(7)b^t=g_{i\mu}B^iu^\mu,\qquad b^i=\frac{B^i+b^tu^i}{u^t}. \tag*{(7)}

For numerical purposes, the code uses the projected four-velocity u~i\tilde{u}^{i}, defined as:

u~i=γ μiuμ=ui+βiαΓ,(8)\tilde{u}^{i}=\gamma^{i}_{\ \mu}u^{\mu}=u^{i}+\frac{\beta^{i}}{\alpha}\Gamma, \tag*{(8)}

where γ μν=δ μν+nνnμ\gamma^{\nu}_{\ \mu}=\delta^{\nu}_{\ \mu}+n^{\nu}n_{\mu} is the spatial projection operator, and nμ=(−α,0,0,0)n_{\mu}=(-\alpha,0,0,0) is the unit normal one-form to the hypersurface t=constt=\mathrm{const}. The corresponding contravariant vector is nμ=(1/α,−βi/α)n^{\mu}=(1/\alpha,-\beta^{i}/\alpha). In this expression, α=1/−gtt\alpha=1/\sqrt{-g^{tt}} is the lapse function, βi=α2gti\beta^{i}=\alpha^{2}g^{ti} is the shift vector, and Γ=αut\Gamma=\alpha u^{t} is the Lorentz factor measured by an Eulerian observer ([56, 63]).

The code uses Kerr–Schild coordinates, given by the line element:

ds2=−(1−2MBHrΣ)dt2+4MBHrΣdt dr+(1+2MBHrΣ)dr2+Σ dθ2+AKSsin⁡2θ dϕ2−4aMBHrsin⁡2θΣdt dϕ−2a(1+2MBHrΣ)sin⁡2θ dr dϕ,(9)\begin{aligned} ds^{2}={}&-\left(1-\frac{2M_{\mathrm{BH}}r}{\Sigma}\right)dt^{2}+\frac{4M_{\mathrm{BH}}r}{\Sigma}dt\,dr+\left(1+\frac{2M_{\mathrm{BH}}r}{\Sigma}\right)dr^{2}+\Sigma\,d\theta^{2}\\ &+A_{\mathrm{KS}}\sin^{2}\theta\,d\phi^{2}-\frac{4aM_{\mathrm{BH}}r\sin^{2}\theta}{\Sigma}dt\,d\phi\\ &-2a\left(1+\frac{2M_{\mathrm{BH}}r}{\Sigma}\right)\sin^{2}\theta\,dr\,d\phi, \tag*{(9)} \end{aligned}

where MBHM_{\mathrm{BH}} is the black hole mass, aa is the dimensional Kerr spin parameter, Σ≡r2+a2cos⁡2θ\Sigma\equiv r^{2}+a^{2}\cos^{2}\theta, and AKS≡Σ+a2(1+2MBHr/Σ)sin⁡2θA_{\mathrm{KS}}\equiv\Sigma+a^{2}(1+2M_{\mathrm{BH}}r/\Sigma)\sin^{2}\theta. The corresponding dimensionless spin of the black hole is a∗=a/MBHa_{*}=a/M_{\mathrm{BH}}. In general, both the black hole mass and the dimensional Kerr spin parameter may evolve with time.

The metric is subsequently transformed to the code coordinates. This transformation introduces a logarithmic radial grid and concentrates resolution toward the equatorial region. The transformation from the Kerr–Schild coordinates xμ=(t,r,θ,ϕ)x^{\mu}=(t,r,\theta,\phi) to the so-called modified Kerr–Schild coordinates (MKS) x′μ=(t,x1,x2,x3)x^{\prime\mu}=(t,x_{1},x_{2},x_{3}) is given by:

r=ex1,θ=πx2+1−h2sin⁡(2πx2),ϕ=x3,(10)r=e^{x_{1}},\qquad\theta=\pi x_{2}+\frac{1-h}{2}\sin(2\pi x_{2}),\qquad\phi=x_{3}, \tag*{(10)}

where h∈(0,1]h\in(0,1] is a parameter that adjusts the grid density near the equator. The initial conditions are specified in Boyer–Lindquist coordinates ([5]), then transformed to Kerr–Schild coordinates and finally to modified Kerr–Schild coordinates. For example, the metric components transform as:

gμν′=∂xα∂x′μ∂xβ∂x′νgαβ.(11)g^{\prime}_{\mu\nu}=\frac{\partial x^{\alpha}}{\partial x^{\prime\mu}}\frac{\partial x^{\beta}}{\partial x^{\prime\nu}}g_{\alpha\beta}. \tag*{(11)}

After the transformation, the computational grid is uniform in the numerical coordinates. All vector and tensor components are transformed using the Jacobian of the complete coordinate transformation.

Quasi-Stationary Kerr Black Hole Evolution

The code includes an optional quasi-stationary evolution of the central Kerr black hole’s mass and spin ([42] (D. Ł. Król & A. Janiuk 2021)), by calculating corresponding fluxes through the radial inner boundary, which is located inside the event horizon. The spacetime remains Kerr at each time step, and the full set of Einstein equations is not solved. Instead, we assume that the evolution is quasi-stationary from one time step to the next. The dimensional Kerr spin parameter evolves according to

dadt=J˙MBH−aMBHE˙,(12)\frac{da}{dt}=\frac{\dot{J}}{M_{\mathrm{BH}}}-\frac{a}{M_{\mathrm{BH}}}\dot{E}, \tag*{(12)}

where J˙\dot{J} and E˙\dot{E} are the angular-momentum and energy fluxes through the inner boundary. The angular momentum flux J˙\dot{J} is calculated as

J˙≡−∫dθdϕ−g T ϕr.(13)\dot{J}\equiv-\int d\theta d\phi\sqrt{-g}\,T^{r}_{\ \phi}. \tag*{(13)}

The corresponding energy accretion rate is calculated as

E˙=∫dθdϕ−g T tr,(14)\dot{E}=\int d\theta d\phi\sqrt{-g}\,T^{r}_{\ t}, \tag*{(14)}

and is used to update the black hole mass according to

dMBHdt=E˙.(15)\frac{dM_{\mathrm{BH}}}{dt}=\dot{E}. \tag*{(15)}

The use of energy and angular momentum fluxes for black hole spin and mass evolution is based on C. F. Gammie et al. [25]. To satisfy energy-momentum conservation (Eq. (1)) in quasi-stationary evolving spacetime, a source term should be added to the energy conservation, given as follows:

St=12−gTμν∂tgμν.(16)S_{t}=\frac{1}{2}\sqrt{-g}T^{\mu\nu}\partial_{t}g_{\mu\nu}. \tag*{(16)}

The time derivative of the metric is given by:

∂tgμν=(∂gμν∂MBHM˙BH+∂gμν∂aa˙),(17)\partial_{t}g_{\mu\nu}=\left(\frac{\partial g_{\mu\nu}}{\partial M_{\mathrm{BH}}}\dot{M}_{\mathrm{BH}}+\frac{\partial g_{\mu\nu}}{\partial a}\dot{a}\right), \tag*{(17)}

where M˙BH\dot{M}_{\mathrm{BH}} and a˙\dot{a} are given by Eqs. (15) and (12), respectively. In the code, we take into account the full stress-energy tensor, including both the fluid and electromagnetic parts. The latter is essential to capture the Blandford–Znajek process ([4]), especially the black hole spin-down, through extraction of its angular momentum and rotational energy.

Weak-field self-gravity approximation

Three-dimensional simulations with dynamical spacetime have recently become possible; however, long-duration models are extremely expensive computationally ([34]. One commonly used approach to simplify the problem is the conformally flat approximation ([8]). For instance, in Schwarzschild spacetime, the spatial metric can be written in a conformally flat form in isotropic coordinates, γij=ψ4fij\gamma_{ij} = \psi^{4}f_{ij}, where ψ\psi is the conformal factor and fijf_{ij} is the flat spatial metric. Nevertheless, this condition is not generally valid for Kerr spacetime ([26]). One possible way to include self-gravity is to treat it as an effective enclosed-mass metric ([41] (P. Płonka & A. Janiuk 2026)). In this approach, neglecting the radial derivatives of the effective parameters, we can obtain an approximately correct radial monopole acceleration. Nevertheless, such a metric treatment does not satisfy Einstein’s equations. A common strategy, for instance in tidal disruption event (TDE) simulations, is to treat self-gravity as a metric perturbation with Newtonian scalar potential ([78, 6]), which gives the correct Newtonian force.

In this paper, we use a different method of taking into account self-gravity, treating it as a scalar potential that generates a four-force on top of the Kerr background. We solve the Poisson equation:

∇2Φ=4πϱ,(18)\nabla^{2}\Phi= 4\pi\varrho, \tag*{(18)}

where ∇2\nabla^{2} denotes the Laplacian written in spherical coordinates, and the effective gravitational density ϱ=E+S\varrho= E + S, where E=TμνnμnνE = T_{\mu\nu}n^{\mu}n^{\nu} is the energy density measured by an Eulerian observer, and S=γijTijS = \gamma^{ij}T_{ij} is the trace of the spatial stress tensor ([32]). The auxiliary spherical coordinates are numerically identified with the spherical Kerr–Schild coordinates after the MKS (Eq. (10)) mapping (for a≠0a \ne0, this is only computational identification). The source term can be written as follows:

ϱ=(ρ+u+p+b2)(2Γ2−1)+2p−2(bμnμ)2.(19)\varrho= \left(\rho+ u + p + b^{2}\right)\left(2\Gamma^{2} - 1\right) + 2p - 2\left(b^{\mu}n_{\mu}\right)^{2}. \tag*{(19)}

In the cold (u≪ρu \ll\rho and p≪ρp \ll\rho), non-relativistic (Γ≃1\Gamma\simeq1), and weakly magnetized (b2≪ρb^{2} \ll\rho) limit, the effective gravitational density defined above reduces to the rest-mass density, and the standard Newtonian Poisson equation is obtained. Our source term includes relativistically motivated contributions, and in addition to the rest-mass density, it also contains internal energy, pressure, and magnetic field energy as sources of the gravitational field ([16, 66, 36, 65]).

Our treatment is an effective weak-field source-term model and is not a systematic perturbative solution of the Einstein equations. We compute the self-gravity potential using the flat-space Poisson equation (Eq. (18)). This approximation is justified only for the weak gravity of the surrounding matter, ∣Φ∣≪1|\Phi| \ll1. The flat-space Poisson operator is used as a practical and numerical approximation. The largest local errors are expected near the black hole, where the dynamics is dominated by the gravitational field of the Kerr black hole and not by the fluid’s weak-field gravity. The accuracy of this approximation is discussed in Sect. 7.

A natural way to solve the Poisson equation in spherical coordinates is to use spherical harmonics and a Green’s function. We follow the method described in [10] to avoid the self-potential error, reconstructing the potential on the cell interfaces. We project the effective density onto spherical harmonics:

ϱℓm(r)=∫02π∫0πϱ(r,θ,ϕ)Yℓm∗(θ,ϕ) dΩ,(20)\varrho_{\ell m}(r) = \int_{0}^{2\pi}\int_{0}^{\pi} \varrho(r,\theta,\phi)Y_{\ell m}^{*}(\theta,\phi)\,d\Omega, \tag*{(20)}

where ϱℓm\varrho_{\ell m} is the radial coefficient of the effective density in the spherical harmonic expansion, Yℓm∗Y_{\ell m}^{*} is the complex conjugate of the spherical harmonic, and dΩ=sin⁡θ dθ dϕd\Omega= \sin\theta\,d\theta\,d\phi. On the modified Kerr–Schild (Eq. (10)) grid, the angular integral is computed using the solid angle of each mapped grid cell. Subsequently, we compute the corresponding spherical harmonic component of the gravitational potential, Φℓm\Phi_{\ell m}, using the Green’s function method. We evaluate the solution both at cell centers, rir_i, and at radial cell interfaces, ri+12r_{i+\frac{1}{2}}, since the interface values are used for the averaging procedure adopted to avoid the self-potential error. The Green’s function solution is given by:

Φℓm(r)=−4π2ℓ+1[1rℓ+1∫rinrϱℓm(r′)r′ℓ+2 dr′+rℓ∫rroutϱℓm(r′)r′1−ℓ dr′].(21)\Phi_{\ell m}(r) = -\frac{4\pi}{2\ell+1}\left[\frac{1}{r^{\ell+1}}\int_{r_{\mathrm{in}}}^{r}\varrho_{\ell m}(r')r'^{\ell+2}\,dr' + r^{\ell}\int_{r}^{r_{\mathrm{out}}}\varrho_{\ell m}(r')r'^{1-\ell}\,dr'\right]. \tag*{(21)}

The solution uses only the effective gravitational density inside the computation domain, rin≤r≤routr_{\mathrm{in}} \le r \le r_{\mathrm{out}}. The black hole is not included in the Poisson source, because its gravity is already described by the Kerr metric (Eq. (9)). In the quasi-stationary metric update, we calculate the fluxes (Eq. (12) and Eq. (15)) through the inner boundary. The integral is evaluated on the logarithmic grid using the corresponding quadrature weights. The potential reconstructed at the radial cell interface is calculated as:

Φi−12,j,k=∑ℓ=0ℓmax⁡∑m=−ℓℓΦℓm(ri−12)Yℓm(θj,ϕk).(22)\Phi_{i-\frac{1}{2},j,k}=\sum_{\ell=0}^{\ell_{\max}}\sum_{m=-\ell}^{\ell}\Phi_{\ell m}\left(r_{i-\frac{1}{2}}\right)Y_{\ell m}(\theta_j,\phi_k). \tag*{(22)}

The other radial face, Φi+12,j,k\Phi_{i+\frac{1}{2},j,k}, is computed in the same way using ri+12r_{i+\frac{1}{2}}. The angular face values are computed analogously at fixed rir_i, using the face-centered angular coordinates θj±1/2\theta_{j\pm1/2} and ϕk±1/2\phi_{k\pm1/2}. The final cell-centered value is computed as the average of the six reconstructed face values, given by:

Φi,j,k=16(Φi−12,j,k+Φi+12,j,k+Φi,j−12,k+Φi,j+12,k+Φi,j,k−12+Φi,j,k+12).(23)\Phi_{i,j,k}=\frac{1}{6}\left(\Phi_{i-\frac{1}{2},j,k}+\Phi_{i+\frac{1}{2},j,k}+\Phi_{i,j-\frac{1}{2},k} +\Phi_{i,j+\frac{1}{2},k}+\Phi_{i,j,k-\frac{1}{2}}+\Phi_{i,j,k+\frac{1}{2}}\right). \tag*{(23)}

The gradient of the gravitational potential is computed using a fourth-order finite-difference approximation (A. Mandal et al. [55]) in code coordinates:

−∇xΦ=−43Φi+1,j,k−Φi−1,j,k2Δx+13Φi+2,j,k−Φi−2,j,k4Δx+O(Δx4),(24)-\nabla_x\Phi=-\frac{4}{3}\frac{\Phi_{i+1,j,k}-\Phi_{i-1,j,k}}{2\Delta x} +\frac{1}{3}\frac{\Phi_{i+2,j,k}-\Phi_{i-2,j,k}}{4\Delta x}+O(\Delta x^4), \tag*{(24)}

and analogously in the two other directions. Although this stencil is fourth-order accurate, the full self-gravity method is only second-order accurate, because of the cell-centered potential reconstruction.

The implementation of multipole weak-field self-gravity is built on top of the Kerr metric. We treat the self-gravity contribution as a scalar potential that generates a four-force perpendicular to the fluid four-velocity. We do not modify the Kerr metric itself. We therefore prescribe the self-gravity four-force as:

Gμ=−Tμν∇νΦ,uμGμ=0,(25)G^\mu=-\mathcal{T}^{\mu\nu}\nabla_\nu\Phi,\qquad u_\mu G^\mu=0, \tag*{(25)}

where the passive magnetohydrodynamic inertial response tensor is given by the following equation:

Tμν=(ρ+u+p+b2)(gμν+uμuν)−bμbν,(26)\mathcal{T}^{\mu\nu}=(\rho+u+p+b^2)(g^{\mu\nu}+u^\mu u^\nu)-b^\mu b^\nu, \tag*{(26)}

which is obtained by collecting the acceleration-dependent terms in the projected momentum equation (see Appendix § 11). The orthogonality of the four-force implies that it does not directly heat or cool the gas in the comoving reference frame. In the quasi-stationary approximation, we neglect the time derivative of the potential when calculating the four-force. The energy–momentum equation takes the form:

∇μTμν=Gν.(27)\nabla_\mu\mathcal{T}^{\mu\nu}=G^\nu. \tag*{(27)}

Our model is an effective approximation of self-gravity, which can provide non-purely monopole acceleration,

which is important in amplifying non-axisymmetric structures. Optionally, the code can also use the ℓ=1\ell=1 coefficients to include an indirect potential associated with the black hole’s reflex acceleration ([58, 75]). The dipole terms are used to calculate the acceleration of the black hole. In the black hole frame, we add the opposite uniform acceleration to the gas. However, the model does not include the full response of the metric to the fluid or gravitational waves.

Numerical scheme

The numerical scheme of the code is based on the conservative, finite-volume, shock-capturing general relativistic magnetohydrodynamics code HARM ([24, 63]), with an extension for the quasi-stationary update of the Kerr black hole mass and spin used in [42] (); D. Ł. Król & A. Janiuk 2021). The code solves the GRMHD equations (Eq. (1)) in flux-conservative form given by:

∂tU(P)+∂iFi(P)=SΓ(P)+SΦ(P).(28)\partial_t U(\mathbf{P})+\partial_i F^i(\mathbf{P})=S_{\Gamma}(\mathbf{P})+S_{\Phi}(\mathbf{P}). \tag*{(28)}

The geometrical source term SΓS_{\Gamma}, representing the contribution of the curved spacetime geometry to the conservative evolution equations, is given by:

SΓ=−g(0,T λκΓ tκλ,T λκΓ iκλ,0),(29)S_{\Gamma}=\sqrt{-g}\left(0,T^\kappa_{\ \lambda}\Gamma^\lambda_{\ t\kappa},T^\kappa_{\ \lambda}\Gamma^\lambda_{\ i\kappa},0\right), \tag*{(29)}

where Γμνλ\Gamma^\lambda_{\mu\nu} are the Christoffel symbols, calculated using a finite difference method in modified Kerr–Schild coordinates. The time derivatives are included separately through StS_t (Eq. (16)). When the self-gravity module is enabled, the four-force Gμ=gμνGνG_\mu=g_{\mu\nu}G^\nu (Eq. (25)) defined in Sect. 4 is added as:

SΦ=−g(0,Gt,Gi,0).(30)S_{\Phi}=\sqrt{-g}\left(0,G_t,G_i,0\right). \tag*{(30)}

In the code, we use conserved variables UU and primitive variables P\mathbf{P}. The conserved variables are evolved in time, while the primitive variables are used to compute the fluxes, source terms, characteristic wave speeds, equation of state and other physical quantities used by the numerical scheme. The vector of conserved variables is defined as follows:

U=−g(ρut,T tt+ρut,T jt,Bi).(31)U=\sqrt{-g}\left(\rho u^t,T^t_{\ t}+\rho u^t,T^t_{\ j},B^i\right). \tag*{(31)}

where the conserved rest-mass contribution is added to the energy variable for numerical stability. The vector of primitive variables is given by:

P≡(ρ,u,u~i,Bi),(32)\mathbf{P}\equiv(\rho,u,\tilde{u}^i,B^i), \tag*{(32)}

where u~i\tilde{u}^i is the projected four-velocity (Eq. (8)). The primitive variables are used to calculate the physical fluxes through the cell interfaces. The flux vector is defined as:

Fi≡−g(ρui, T ti+ρui, T ji, bkui−biuk).(33)F^i \equiv\sqrt{-g}\left(\rho u^i,\ T^i_{\ t}+\rho u^i,\ T^i_{\ j},\ b^k u^i-b^i u^k\right). \tag*{(33)}

The numerical fluxes between neighboring cells are computed using an approximate Riemann solver. The code uses either the HLLE (Harten–Lax–van Leer–Einfeldt) Riemann solver (A. Harten et al. [33]; B. Einfeldt [17]) or the Lax–Friedrichs (P. D. Lax [50]; K. O. Friedrichs [22]; V. Rusanov [77]). The primitive variables are reconstructed at cell interfaces using the third-order piecewise parabolic method (PPM; P. Colella & P. R. Woodward [9]). Additionally, we implement a piecewise-linear reconstruction method (PLM), with either the monotonized central (MC) or MINMOD (minimum modulus) slope limiter. The reconstruction method is selected by the user. After reconstructing the left and right primitive states, PLP_L and PRP_R, at the cell interface, we calculate the HLLE flux:

FHLLE=λmax⁡FL+λmin⁡FR−λmax⁡λmin⁡(UR−UL)λmax⁡+λmin⁡,(34)F_{\mathrm{HLLE}}=\frac{\lambda_{\max}F_L+\lambda_{\min}F_R-\lambda_{\max}\lambda_{\min}\left(U_R-U_L\right)}{\lambda_{\max}+\lambda_{\min}}, \tag*{(34)}

where λmax⁡=max⁡(0,λ+,L,λ+,R)\lambda_{\max}=\max(0,\lambda_{+,L},\lambda_{+,R}), and λ+,L\lambda_{+,L} and λ+,R\lambda_{+,R} are the right-going characteristic wave speeds estimated from the left and right reconstructed states, respectively. Similarly, λmin⁡=−min⁡(0,λ−,L,λ−,R)\lambda_{\min}=-\min(0,\lambda_{-,L},\lambda_{-,R}), where λ−,L\lambda_{-,L} and λ−,R\lambda_{-,R} are the corresponding left-going characteristic wave speeds. They are defined as λ=dxi/dt\lambda=dx^i/dt and are obtained as the two roots of the approximate relativistic fast-magnetosonic dispersion relation (C. F. Gammie et al. [24]), given by:

(uμkμ)2−cms2[(uμkμ)2+kμkμ]=0,(35)\left(u^\mu k_\mu\right)^2-c_{\mathrm{ms}}^2\left[\left(u^\mu k_\mu\right)^2+k^\mu k_\mu\right]=0, \tag*{(35)}

where kμk_\mu is the wave-front normal covector, and cmsc_{\mathrm{ms}} is the approximate fast-magnetosonic speed, given by:

cms2=cs2+vA2−cs2vA2,(36)c_{\mathrm{ms}}^2=c_s^2+v_A^2-c_s^2v_A^2, \tag*{(36)}

where cs2=γadp/(ρ+u+p)c_s^2=\gamma_{\mathrm{ad}}p/(\rho+u+p) is the relativistic speed of sound, and vA2=b2/(ρ+u+p+b2)v_A^2=b^2/(\rho+u+p+b^2) is the Alfvén speed. For the more dissipative local Lax–Friedrichs solver, the interface flux is computed as

F=12(FL+FR)−12λtop(UR−UL),(37)F=\frac{1}{2}\left(F_L+F_R\right)-\frac{1}{2}\lambda_{\mathrm{top}}\left(U_R-U_L\right), \tag*{(37)}

where λtop=max⁡(λmax⁡,λmin⁡)\lambda_{\mathrm{top}}=\max(\lambda_{\max},\lambda_{\min}) is the maximum characteristic wave speed. The conserved variables are then evolved in time using the calculated fluxes.

Flux-constrained transport

For the evolution of the magnetic field, we use flux-constrained transport (G. Tóth [92]; C. F. Gammie et al. [24]). This method keeps the discrete magnetic field divergence close to round-off error, as long as the initial magnetic field is divergence-free and the boundary conditions are consistent:

∂iBi=0,Bi=−gBi.(38)\partial_i\mathcal{B}^i=0,\qquad\mathcal{B}^i=\sqrt{-g}B^i. \tag*{(38)}

We compute the edge-centered electromotive forces (EMFs) from the face-centered numerical fluxes of the magnetic field components:

(E1)i,j,k=14[F2(B3)i,j,k+F2(B3)i,j,k−1−F3(B2)i,j,k−F3(B2)i,j−1,k],(39)(\mathcal{E}^1)_{i,j,k}=\frac{1}{4}\left[F^2(\mathcal{B}^3)_{i,j,k}+F^2(\mathcal{B}^3)_{i,j,k-1}-F^3(\mathcal{B}^2)_{i,j,k}-F^3(\mathcal{B}^2)_{i,j-1,k}\right], \tag*{(39)}
(E2)i,j,k=14[F3(B1)i,j,k+F3(B1)i−1,j,k−F1(B3)i,j,k−F1(B3)i,j,k−1],(40)(\mathcal{E}^2)_{i,j,k}=\frac{1}{4}\left[F^3(\mathcal{B}^1)_{i,j,k}+F^3(\mathcal{B}^1)_{i-1,j,k}-F^1(\mathcal{B}^3)_{i,j,k}-F^1(\mathcal{B}^3)_{i,j,k-1}\right], \tag*{(40)}
(E3)i,j,k=14[F1(B2)i,j,k+F1(B2)i,j−1,k−F2(B1)i,j,k−F2(B1)i−1,j,k].(41)(\mathcal{E}^3)_{i,j,k}=\frac{1}{4}\left[F^1(\mathcal{B}^2)_{i,j,k}+F^1(\mathcal{B}^2)_{i,j-1,k}-F^2(\mathcal{B}^1)_{i,j,k}-F^2(\mathcal{B}^1)_{i-1,j,k}\right]. \tag*{(41)}

The EMFs are then used to correct the magnetic field fluxes:

F1(B1)i,j,k=0,F^1(\mathcal{B}^1)_{i,j,k}=0,
F1(B2)i,j,k=12[(E3)i,j,k+(E3)i,j+1,k],F^1(\mathcal{B}^2)_{i,j,k}=\frac{1}{2}\left[(\mathcal{E}^3)_{i,j,k}+(\mathcal{E}^3)_{i,j+1,k}\right],
F1(B3)i,j,k=−12[(E2)i,j,k+(E2)i,j,k+1].(42)F^1(\mathcal{B}^3)_{i,j,k}=-\frac{1}{2}\left[(\mathcal{E}^2)_{i,j,k}+(\mathcal{E}^2)_{i,j,k+1}\right]. \tag*{(42)}

The fluxes in the other spatial directions are corrected analogously. After this correction, the finite-volume update of the magnetic field is equivalent to a discrete curl of the EMFs. This construction uses the same EMF for neighboring faces, so the discrete divergence of the magnetic field remains zero.

Conserved-variable update

The timestep is estimated from the characteristic speeds computed during the flux calculation. In each direction, the timestep limit is given by:

Δti=CFLΔximax⁡(λmax⁡,λmin⁡).(43)\Delta t_i=\mathrm{CFL}\frac{\Delta x_i}{\max\left(\lambda_{\max},\lambda_{\min}\right)}. \tag*{(43)}

where CFL is the Courant–Friedrichs–Lewy (CFL) factor, and λmax⁡\lambda_{\max} and λmin⁡\lambda_{\min} are the characteristic wave speeds defined above. In three dimensions, the directional limits are combined as

Δt=(1Δt1+1Δt2+1Δt3)−1.(44)\Delta t=\left(\frac{1}{\Delta t_1}+\frac{1}{\Delta t_2}+\frac{1}{\Delta t_3}\right)^{-1}. \tag*{(44)}

The timestep is additionally limited by the safety factor (fsafe=0.9f_{\mathrm{safe}} = 0.9), the maximum timestep (Δtmax⁡=10\Delta t_{\max} = 10), and the maximum growth factor (fgrow=1.3f_{\mathrm{grow}} = 1.3).

The conserved variables (Eq. (28)) are evolved using the second-order explicit midpoint Runge–Kutta method (RK2). We first define the evolution operator:

L(U)=−∂iFPi(P(U))+SΓ(P(U))+SΦ(P(U)).(45)\mathcal{L}(U) = -\partial_i F^i_{\mathrm{P}}(P(U)) + S_{\Gamma}(P(U)) + S_{\Phi}(P(U)). \tag*{(45)}

Starting from the current state UnU^n, we first calculate the midpoint state Un+1/2U^{n+1/2}. Then, we use this midpoint state to calculate the new state Un+1U^{n+1}:

Un+1/2=Un+Δt2L(Un),U^{n+1/2} = U^n + \frac{\Delta t}{2}\mathcal{L}(U^n),
Un+1=Un+Δt L(Un+1/2).(46)U^{n+1} = U^n + \Delta t\,\mathcal{L}(U^{n+1/2}). \tag*{(46)}

When self-gravity is enabled, the potential is recomputed from the intermediate primitive state before the second Runge–Kutta stage. The mass and spin of the black hole, metric coefficients, and geometrical source terms are also updated at the intermediate stage.

Primitive variable recovery

The primary primitive-variable recovery method is performed by the two-dimensional method (S. C. Noble et al. [63]). We define the auxiliary energy–momentum density four-vector QμQ_\mu, measured by the normal observer, and its spatial projection Q~μ\widetilde{Q}^{\mu}, given by:

Qμ=−nνT μν,Q~μ=γ νμQν.(47)Q_\mu= -n_\nu T^\nu_{\ \mu}, \qquad\widetilde{Q}^{\mu} = \gamma^\mu_{\ \nu}Q^\nu. \tag*{(47)}

We introduce the auxiliary variable W≡Γ2wW \equiv\Gamma^2 w, where w≡ρ+u+pw \equiv\rho+ u + p is the enthalpy density. Additionally, we define the magnetic field four-vector measured by the normal observer as Bμ=−nν∗Fμν\mathcal{B}^{\mu} = -n_\nu{}^{*}F^{\mu\nu}. The primitive-variable recovery is then reduced to solving the following two equations for WW and v2v^2:

{Q~2=v2(B2+W)2−(QμBμ)2(B2+2W)W2,Qμnμ=−B22(1+v2)+(QμBμ)22W2−W+p(u,ρ).(48)\left\{ \begin{aligned} \widetilde{Q}^2 &= v^2(\mathcal{B}^2 + W)^2 - \frac{(Q_\mu\mathcal{B}^{\mu})^2(\mathcal{B}^2 + 2W)}{W^2}, \\ Q_\mu n^\mu&= -\frac{\mathcal{B}^2}{2}(1+v^2) + \frac{(Q_\mu\mathcal{B}^{\mu})^2}{2W^2} - W + p(u,\rho). \end{aligned} \right. \tag*{(48)}

For the ideal-gas equation of state, the pressure can be expressed as a function of the two variables above:

p=(γad−1γad)[W(1−v2)−D1−v2],(49)p = \left(\frac{\gamma_{\mathrm{ad}}-1}{\gamma_{\mathrm{ad}}}\right)\left[W(1-v^2)-D\sqrt{1-v^2}\right], \tag*{(49)}

where D=ρΓD = \rho\Gamma. The system of equations is solved using the Newton–Raphson method. In addition, we evolve the entropy variable K=p/ργadK = p/\rho^{\gamma_{\mathrm{ad}}} as an auxiliary conserved variable. If the two-dimensional recovery fails, the code first uses an isentropic one-dimensional root-finding method for v2v^2. If this also fails, it uses a second isentropic one-dimensional method to solve for WW.

If all recovery methods fail, we use neighbouring-cell averaging of hydrodynamic variables, with recovery flags exchanged between MPI subdomains. Other primitive recovery methods have also been proposed in previous studies (D. M. Siegel et al. [83]; W. Kastaun et al. [45]). After recovery, we apply numerical floors:

ρatm=max⁡(10−8r−2,10−20),\rho_{\mathrm{atm}} = \max\left(10^{-8}r^{-2},10^{-20}\right),
uatm=max⁡(10−10r−2γad,10−20).(50)u_{\mathrm{atm}} = \max\left(10^{-10}r^{-2\gamma_{\mathrm{ad}}},10^{-20}\right). \tag*{(50)}

These are the default floor values in FUGUE and can be adjusted for different simulations and scientific goals. For example, higher floors are used in the GRMHD code comparison in Sect. 6.1. The final floors also include magnetization limits. In particular, we limit the magnetization to σ=b2/ρ≤50\sigma= b^2/\rho\le50 and the internal-energy magnetization to b2/u≤2500b^2/u \le2500, a limit on the internal-energy-to-density ratio u/ρ≤50u/\rho\le50, and the Lorentz factor ceiling Γ≤50\Gamma\le50. These values are used as the default settings in our simulations. Additionally, in the code, we use drifting floors in highly magnetized regions, where numerical floors are applied. The velocity is adjusted toward the drift-frame velocity, which helps to avoid unphysical velocities after the floors add mass or internal energy.

At the radial boundaries, the code copies primitive variables into ghost zones. The code uses three ghost zones in each spatial direction for PPM reconstruction and two for PLM. The condition for no-inflow is applied to prevent matter from entering the computational domain radially. At the polar boundaries, reflecting boundary conditions are used with the mapping ϕ→ϕ+π\phi\rightarrow\phi+ \pi and the correct sign changes for vector components. The azimuthal boundary conditions are periodic. The code solves the equations of general relativistic magnetohydrodynamics (GRMHD) in both axisymmetric 2.5D and fully three-dimensional configurations.

Numerical validation

We present below a set of numerical tests of the code, performed directly on the GPU version. We begin with special relativistic (SR) hydrodynamics tests, followed by SRMHD tests. Then, we test GRMHD, and finally, we validate the weak-field multipole self-gravity implementation.

Relativistic hydrodynamic shock-tube tests

We begin testing our code with one-dimensional special-relativistic shock-tube tests introduced by Thompson (K. W. Thompson [90]). We adopt the Minkowski metric in Cartesian coordinates. The discontinuity is located in the middle of the grid at x=0.5x = 0.5.

The initial data are presented in Table 1. For all tests (S1 – S3), we use the resolution of N=8192N = 8192 cells. We use outflow boundary conditions at both ends of the domain. The chosen Riemann solver is HLLE. For the reconstruction, we use PPM with shock flattening. The Courant factor is set to CFL = 0.4. The exact results are obtained using the exact Riemann solver [76]. The final time of the evolution is set to t=0.4t = 0.4 for all shock-tubes. In Figure 1 are shown the results obtained with FUGUE, and the exact solutions for tests (S1 – S3). The code accurately reproduces density, pressure, and velocity profiles, including shocks and contact discontinuities, without spurious oscillations.

Test:S1S2S3B1B2B3B4B5
LRLRLRLRLRLRLRLR
ρ\rho1.01.01.010.01.01.01.00.1251.01.01.01.01.01.01.081.0
pp10310^{3}10−210^{-2}10201101.00.130.01.01000.00.10.10.10.951.0
vxv_x00−0.60.50.900.00.00.00.00.00.00.999−0.9990.4−0.45
vyv_y––––––0.00.00.00.00.00.00.00.00.3−0.2
vzv_z––––––0.00.00.00.00.00.00.00.00.20.2
BxB^x––––––0.50.55.05.010.010.010.010.02.02.0
ByB^y––––––1.0−1.06.00.77.00.77.0−7.00.3−0.7
BzB^z––––––0.00.06.00.77.00.77.0−7.00.30.5

Table 1. Initial data for the one-dimensional relativistic shock-tube tests. The discontinuity is located at x0=0.5x_0 = 0.5 in the domain x∈[0,1]x \in[0, 1]. The labels S1–S3 denote the hydrodynamic shock tubes, while B1–B5 denote the Balsara magnetohydrodynamic tests. The adiabatic index is chosen as γad=5/3\gamma_{\mathrm{ad}} = 5/3 for S1 and S2, γad=4/3\gamma_{\mathrm{ad}} = 4/3 for S3, γad=2\gamma_{\mathrm{ad}} = 2 for B1, and γad=5/3\gamma_{\mathrm{ad}} = 5/3 for B2–B5.

Figure 1. Relativistic hydrodynamic shock-tube tests. The figure compares the FUGUE results with the exact solutions for the S1–S3 problems. The calculations use PPM reconstruction, the resolution of N=8192N = 8192, the Courant factor CFL = 0.4, and the final time of t=0.4t = 0.4. The code accurately captures shocks and contact discontinuities in density, pressure, and velocity.

Kelvin–Helmholtz instability

We consider the two-dimensional Kelvin–Helmholtz instability in Cartesian coordinates in Minkowski spacetime. We test whether the code can capture and reproduce the characteristic Kelvin–Helmholtz vortices. The initial setup is based on a similar test described by J. V. Kalinani et al. [44], with a divergence-free velocity perturbation. The computational domain is x,y∈[−0.5,0.5]x,y \in[-0.5,0.5]. We use a uniform 1024×10241024 \times1024 grid with periodic boundary conditions. The adiabatic index is γad=5/3\gamma_{\mathrm{ad}} = 5/3, and the gas pressure is constant with the value p=2.5p = 2.5. The magnetic field is set to zero. The central layer, ∣y∣<ys|y| < y_s, where ys=0.25y_s = 0.25, has density ρ=2\rho= 2 and initial velocity in the xx-direction v0x=0.5v_0^x = 0.5, while the outer layers have density ρ=1\rho= 1 and initial velocity in the xx-direction v0x=−0.5v_0^x = -0.5. This produces two oppositely oriented shear interfaces at y=±0.25y = \pm0.25. We perturb the flow velocity according to the following prescription:

ψ=w0kcos⁡(kx)[exp⁡(−(y−ys)22σ2)+exp⁡(−(y+ys)22σ2)].(51)\psi= \frac{w_0}{k}\cos(kx)\left[\exp\left(-\frac{(y-y_s)^2}{2\sigma^2}\right)+\exp\left(-\frac{(y+y_s)^2}{2\sigma^2}\right)\right]. \tag*{(51)}

This choice makes the initial perturbation divergence-free. We use k=4πk = 4\pi, σ=0.05/2\sigma= 0.05/\sqrt{2}, and w0=0.015w_0 = 0.015. The initial velocity is then vx=v0x+δvxv^x = v_0^x + \delta v^x and vy=δvyv^y = \delta v^y. The velocity perturbations are defined by δvx=∂yψ\delta v^x = \partial_y\psi and δvy=−∂xψ\delta v^y = -\partial_x\psi, which ensures ∂xδvx+∂yδvy=0\partial_x\delta v^x + \partial_y\delta v^y = 0. The system is evolved until t=2.5t = 2.5. The Riemann solver is set to HLLE, with the PLM reconstruction and the MC flux limiter. The Courant factor is set to CFL = 0.8. In Figure 2 we show the density maps for t=1.5t = 1.5, 2.02.0, 2.52.5. The density plot shows the two shear layers rolling up into vortices, demonstrating that the code can properly capture the growth of the Kelvin–Helmholtz instability over time. This indicates that numerical diffusion is low enough to resolve instabilities.

Figure 2. Kelvin–Helmholtz instability test. The panels show density maps at t=1.5t = 1.5, 2.02.0, 2.52.5. The resolution is set to 1024×10241024 \times1024. The reconstruction scheme is chosen as PLM with the MC flux limiter. The Courant factor is set to CFL =0.8= 0.8. The code reproduces the characteristics of rolling up vortices and their evolution in time.

Relativistic magnetohydrodynamic shock-tube tests

We start testing the implementation of relativistic magnetohydrodynamics using Balsara shock-tubes (D. Balsara [1]). The initial conditions are presented in Table 1. We use Minkowski spacetime in Cartesian coordinates. We use the PLM reconstruction method, with the MC flux limiter. The Riemann solver is chosen to be Lax–Friedrichs. The grid resolution is set to N=8192N = 8192, with outflow boundary conditions. The Courant factor is set to CFL = 0.4. The five Balsara problems have different levels of difficulty. For instance, the shock-tube B3 has a very large pressure jump, from p=1000p = 1000 to p=0.1p = 0.1, together with a strong magnetic field, whereas the shock-tube B4 is the most relativistic case, with two flows moving toward each other at vx=±0.999v^x = \pm0.999, and a transverse magnetic field that changes sign across the initial discontinuity. Tests B1–B4 are evolved to t=0.4t = 0.4, while test B5 is evolved to t=0.55t = 0.55. In Figure 3, we present profiles of density ρ\rho and the magnetic field ByB^y. The numerical results are compared with the exact solutions ([28]). These tests include strong shocks and sharp changes in the fluid variables. They test whether the numerical methods work correctly in difficult cases. Even in the most extreme cases, the code provides solutions in close agreement with the exact solutions. We do not observe overshooting or oscillations near discontinuities.

Figure 3. Relativistic magnetohydrodynamic Balsara shock-tube tests. Red crosses show the numerical solutions obtained with FUGUE, whereas the black curves show the corresponding exact solutions. The left panels show the density ρ\rho, and the right panels show the transverse magnetic field component ByB^{y}.

Linear waves

We test the convergence order of the code using standard one-dimensional linear-wave problems in the Cartesian Minkowski spacetime. We consider the entropy, fast magnetosonic, slow magnetosonic, and Alfvén waves ([86, 52]). The computational grid is set to x∈[−0.5,0.5]x \in[-0.5,0.5] with periodic boundary conditions. We test resolutions N∈{64,128,256,512}N \in\{64, 128, 256, 512\}. We initialize each type of wave by adding a small-amplitude perturbation proportional to the eigenvector of the corresponding linear mode. The amplitude is chosen to be A=10−4A = 10^{-4}. We use the PLM method for reconstruction with the MINMOD flux limiter. The Riemann solver is HLLE. The Courant factor is set to CFL = 0.4. In Figure 4, we show the absolute L1L_1 error after one period. The error is the mean absolute difference between the final and initial states, averaged over all grid cells and all primitive variables with non-zero perturbations. The test shows second-order convergence for all tested waves.

Absolute $L_1$ error for entropy, fast magnetosonic, slow magnetosonic, and Alfvén waves

Figure 4. The absolute L1L_1 error for entropy, fast magnetosonic, slow magnetosonic, and Alfvén waves. Each wave is initialized with a small-amplitude perturbation from the corresponding eigenvector. The error decreases at approximately second order with increasing resolution.

Blast-wave test

We consider the two-dimensional cylindrical blast wave in a uniformly magnetized medium ([47, 13]). The initial conditions describe a dense and over-pressured circular region surrounded by low-density ambient medium. In contrast to the one-dimensional shock-tube tests, there is no analytic solution; therefore, the comparison is usually based on reproducing the characteristic solution structures reported in the literature. The computational domain covers x,y∈[−6,6]x,y \in[-6,6], with the resolution set to 1024×10241024 \times1024 cells. The adiabatic index is set to γad=4/3\gamma_{\mathrm{ad}} = 4/3, the final time is t=4.0t = 4.0, and the Courant factor is CFL = 0.4. As the reconstruction method, we use PLM with the MINMOD flux limiter. The approximate Riemann solver is chosen to be HLLE. Initially, the fluid velocity is set to zero everywhere, while the magnetic field is uniform and given by Bx=0.1B^{x} = 0.1, By=0B^{y} = 0, and Bz=0B^{z} = 0. The cylinder is specified by the smoothing radii rin=0.8r_{\mathrm{in}} = 0.8 and rout=1.0r_{\mathrm{out}} = 1.0. Inside the cylinder, we set the density ρin=10−2\rho_{\mathrm{in}} = 10^{-2} and the pressure pin=1.0p_{\mathrm{in}} = 1.0, while in the outer medium we set ρout=10−4\rho_{\mathrm{out}} = 10^{-4} and pout=3×10−5p_{\mathrm{out}} = 3 \times10^{-5}. The density is set in the zone rin≤r≤routr_{\mathrm{in}} \le r \le r_{\mathrm{out}} by the following equation:

ρ(r)=exp⁡[(rout−r)ln⁡ρin+(r−rin)ln⁡ρoutrout−rin].(52)\rho(r) = \exp\left[\frac{(r_{\mathrm{out}} - r)\ln\rho_{\mathrm{in}} + (r - r_{\mathrm{in}})\ln\rho_{\mathrm{out}}}{r_{\mathrm{out}} - r_{\mathrm{in}}}\right]. \tag*{(52)}

In Figure 5, we show the state at the final time t=4.0t = 4.0. The left panels show two-dimensional maps of the magnetic pressure b2/2b^{2}/2, Lorentz factor Γ\Gamma, and magnetic field components BxB^{x} and ByB^{y}. The right panels show one-dimensional slices along the xx and yy axes with the density ρ\rho. The code reproduces results known from the literature, and remains numerically stable.

Figure 5. Two-dimensional cylindrical relativistic magnetohydrodynamics blast-wave test. The left panels show maps of magnetic pressure b2/2b^2/2, Lorentz factor Γ\Gamma, and magnetic field components BxB^x and ByB^y at the final time t=4.0t=4.0. The right panels show one-dimensional slices along the xx and yy directions. Black lines in the Lorentz-factor panel show the magnetic field.

Magnetic rotator

We consider the relativistic magnetic rotor test [2, 92]. The test describes a dense rotating cylinder in a uniform magnetic field. The computational domain is x,y∈[−0.5,0.5]x, y \in[-0.5, 0.5]. We use the resolution of 1024×10241024 \times1024 cells. The ideal-gas equation of state with γad=5/3\gamma_{\mathrm{ad}} = 5/3 is adopted. The final time is t=0.4t = 0.4, and the Courant factor is CFL =0.25= 0.25. We use the HLLE Riemann solver with PLM reconstruction, with the MINMOD flux limiter. The rotor has a radius of R=0.1R = 0.1. Inside the rotor, the density is ρin=10\rho_{\mathrm{in}} = 10, while outside it is set to ρout=1\rho_{\mathrm{out}} = 1. The pressure is uniform and equal to p=1p = 1. The magnetic field is also uniform and is initially given by Bx=1B^{x} = 1, By=Bz=0B^{y} = B^{z} = 0. Inside the rotor, the gas rotates with angular velocity Ω=9.95\Omega= 9.95, so the velocities are given by vx=−Ωyv^{x} = -\Omega y and vy=Ωxv^{y} = \Omega x. This gives a maximum speed close to vmax⁡=0.995v_{\max} = 0.995 at the edge of the rotor. The fluid outside the rotor is at rest. In Figure 6, we show the result at the final time. The maps show the density, pressure, magnetic pressure b2/2b^{2}/2, and Lorentz factor Γ\Gamma, with the magnetic field lines. On the right side, the slices are shown along xx and yy. The results of magnetic rotator test show the structures known from the literature, indicating that the code can handle extreme rotating magnetized fluid and stays stable.

Figure 6. Relativistic magnetic-rotor test. The left panels show two-dimensional maps of density ρ\rho, pressure pp, magnetic pressure b2/2b^2/2, and Lorentz factor Γ\Gamma at the final time. The right panels show one-dimensional slices along the xx and yy directions. The result shows that the code can handle strong magnetic stresses and remains stable.

Advection loop test

We consider the magnetic-loop advection test [27] in Cartesian coordinates in Minkowski spacetime. The test describes the advection of a weak magnetic loop by a uniform fluid flow. The computational domain is x,y∈[−0.5,0.5]x, y \in[-0.5, 0.5]. We use periodic boundary conditions in all directions. The grid resolution is 1024×10241024 \times1024 cells. The gas is initially uniform, with ρ=1\rho= 1, p=3p = 3, and adiabatic index γad=5/3\gamma_{\mathrm{ad}} = 5/3. The velocity is constant and is set to vx=1/12v^{x} = 1/12, vy=1/24v^{y} = 1/24, and vz=1/24v^{z} = 1/24. We use the HLLE Riemann solver, with PLM reconstruction and the MINMOD flux limiter. The CFL is set to CFL =0.4= 0.4. We set Az=Aloopmax⁡(Rloop−r,0)A_{z} = A_{\mathrm{loop}}\max(R_{\mathrm{loop}} - r, 0), where r=x2+y2r = \sqrt{x^{2} + y^{2}}, Aloop=10−3A_{\mathrm{loop}} = 10^{-3}, and Rloop=0.3R_{\mathrm{loop}} = 0.3. The final time is t=24t = 24, which corresponds to two box crossings in the xx direction and one box crossing in the yy direction. In Figure 7, we show BxB^{x} and the magnetic pressure b2/2b^{2}/2 at the initial and final times. This test shows that the code transports weak magnetic fields correctly and keeps the magnetic structure stable over time, with only small numerical diffusion.

Figure 7. Magnetic-loop advection test. The figure shows the magnetic field component BxB^{x} and magnetic pressure b2/2b^{2}/2 at the initial and final times. After two box crossings in the xx direction and one in the yy direction, the loop remains close to its initial shape. This demonstrates that the code advects weak magnetic fields correctly with only small numerical diffusion.

Magnetized Bondi–Michel accretion

After validating special relativistic magnetohydrodynamics, we proceed to test general relativistic magnetohydrodynamics (GRMHD). We start with the magnetized Bondi–Michel accretion solution in Schwarzschild spacetime [59, 20]. The problem has a well-known stationary solution; therefore, it is a useful test for code validation. The black hole mass is set to MBH=1M_{\rm BH}=1, and the spin is set to a⋆=0a_{\star}=0. We use an ideal-gas equation of state with γad=4/3\gamma_{\rm ad}=4/3. The Courant factor is set to CFL=0.4\mathrm{CFL}=0.4. We adopt spherical coordinates and use a resolution of (Nr×Nθ×Nϕ)=(256×128×64)(N_r \times N_\theta\times N_\phi)=(256 \times128 \times64). The Riemann solver is HLLE with PPM as the reconstruction method. The outer boundary is set to rout=100r_{\rm out}=100. At this boundary, we use the Bondi solution for the inflow. The sonic radius is chosen to be rs=8r_s=8, the mass accretion rate is M˙=−1\dot{M}=-1, and the density at the sonic radius is ρ(rs)=1/16\rho(r_s)=1/16. The hydrodynamic solution is obtained by solving the mass-conservation equation above and below the sonic radius, given by:

ρ(r)=M˙r2ur(53)\rho(r)=\frac{\dot{M}}{r^2u^r} \tag*{(53)}

and by the relativistic Bernoulli equation [59], describing conservation of the relativistic energy flux defined as follows:

E˙=r2ur(ρ+γadpγad−1)[1−2Mr+(ur)2]1/2(54)\dot{E}=r^2u^r\left(\rho+\frac{\gamma_{\mathrm{ad}}p}{\gamma_{\mathrm{ad}}-1}\right)\left[1-\frac{2M}{r}+(u^r)^2\right]^{1/2} \tag*{(54)}

assuming that E˙\dot{E} is constant. Here, M˙\dot{M} and E˙\dot{E} are signed fluxes per unit solid angle. At each radius, uru^r is found as the root of the Bernoulli equation using the secant method, and the density from mass conservation. The internal energy is then calculated from the polytropic relation. On top of the Bondi solution, we add a purely radial magnetic field: Br=B0/r2B^{r}=B_{0}/r^{2}, with Bθ=Bϕ=0B^{\theta}=B^{\phi}=0. We perform the test for two magnetic field strengths B0=2B_{0}=2 and B0=6.25B_{0}=6.25. The system is evolved numerically and compared with the initial analytic profiles. We evolve the system to t=100t=100. In Figure 8, the radial profiles of the density ρ\rho, radial velocity uru^{r}, specific internal energy ϵ=u/ρ\epsilon=u/\rho, and magnetic field BrB^{r} are shown. The code preserves the stationary solution for two values of the magnetic field strengths. This test checks both the HD and MHD parts of the GRMHD solver.

Magnetized Bondi–Michel accretion test

Figure 8. Magnetized Bondi–Michel accretion test in Schwarzschild spacetime for two magnetic field strengths, B0=2B_0 = 2 and B0=6.25B_0 = 6.25. The shown variables are the rest-mass density ρ\rho, the radial velocity uru^r, the specific internal energy ϵ\epsilon, and the magnetic field BrB^r. The figure shows radial profiles from the simulation and compares them with the exact solutions. The numerical solutions follow the analytic profile, which shows that the code can reproduce a steady spherical accretion flow.

Fishbone–Moncrief torus

We next test the GR hydrodynamics implementation in the Kerr spacetime. We use the Fishbone–Moncrief torus ([21, 24]), which is in hydrostatic equilibrium (in the absence of a magnetic field) in the Kerr metric. We test the stability of the torus. The spin of the black hole is chosen as a⋆=0.9a_{\star}=0.9. The inner edge of the torus is at rin=6r_{\mathrm{in}}=6, and the pressure maximum is at rmax=12r_{\mathrm{max}}=12. The test is performed in modified Kerr–Schild coordinates with h=0.3h=0.3. We use an ideal-gas equation of state with the adiabatic index γad=4/3\gamma_{\mathrm{ad}}=4/3. The torus is evolved until t=100t=100. For the test, we use the HLLE Riemann solver and PLM reconstruction with MINMOD flux limiter. In Figure 9 we show the absolute L1L_{1} errors separately for the rest-mass density, internal energy density, and the spatial components of the fluid four-velocity, as a function of the grid resolution N∈{128,256,512}N\in\{128,256,512\}. We test the torus in axisymmetry with the resolution Nr×NθN_{r}\times N_{\theta} being the same in radial and polar directions. The errors decrease with approximately second-order accuracy for all variables, indicating that the implementation of GRHD in the Kerr metric, including source terms and geometry, converges to the equilibrium solution.

Figure 9. Convergence of the Fishbone–Moncrief torus test. The figure shows the absolute L1L_1 errors of the primitive variables: the rest-mass density, internal energy density, and the spatial components of the fluid four-velocity, as a function of the grid resolution N×NN \times N. The black dashed line indicates second-order convergence.

GRMHD code comparison benchmark

The comparison between various GRMHD codes showed that their results are broadly consistent ([70]). We test FUGUE, comparing it with state-of-the-art codes. We use the Fishbone–Moncrief initial conditions ([21]), with the parameters of the dimensionless black hole spin a⋆=0.9375a_{\star}=0.9375. The torus has an inner radius rin=6 rgr_{\mathrm{in}}=6\,r_{g} and a pressure maximum at rmax=12 rgr_{\mathrm{max}}=12\,r_{g}. We use γad=4/3\gamma_{\mathrm{ad}}=4/3 and set the initial plasma beta to β=100\beta=100. We add a small 2% perturbation to the internal energy. The grid resolution is 1923192^{3}, with the grid extends radially r∈[1.15,50] rgr\in[1.15,50]\,r_{g} and h=1h=1. Near the polar axis, we use cylindrified MKS coordinates described in Sect. 7. We use the local Lax–Friedrichs flux and PLM reconstruction with the MC limiter, and evolve the model up to t=104 tgt=10^{4}\,t_{g}. We use floors of ρ>10−5rg−2\rho>10^{-5}r_{g}^{-2} and u>10−7rg−2γadu>10^{-7}r_{g}^{-2\gamma_{\mathrm{ad}}}, the same values as iharm3D in [70]. Self-gravity and black hole evolution are turned off. In Figure 10, we present comparison of FUGUE with other codes, comparing horizon diagnostics, namely the mass accretion rate (Eq. (60)), the dimensionless magnetic flux (Eqs. (60) and (61)), the specific angular momentum flux (Eq. (13)), and the reduced energy flux (see Eq. (14)). Apart from the fluctuations expected from MRI-driven turbulence, the evolution proceeds similarly to that of other numerical codes; we do not observe large deviations from the behavior of other codes: Athena++ ([95]), BHAC ([69]), ECHO ([15]), HARM-Noble ([24, 63, 64]), iharm3D ([24, 63, 64, 71]), and KORAL ([85, 84]). We note that this is not a strict one-to-one comparison, as the codes use different numerical schemes, reconstruction methods, and grids. In Table 2, we present results from FUGUE that are analogous to those in Table 2 of

Figure 10. Comparison of FUGUE with the other GRMHD code results at a resolution of 1923192^3. The panels show the horizon diagnostics: the mass accretion rate, the dimensionless magnetic flux, and the specific angular momentum flux, and the reduced energy flux.

Diagnosticmax⟨⋅⟩\langle\cdot\rangle
∣M˙∣|\dot{M}|0.8830.244±0.0680.244 \pm0.068
ΦBH/∣M˙∣\Phi_{\mathrm{BH}}/\sqrt{|\dot{M}|}3.0870.989±0.1290.989 \pm0.129
∣L˙/M˙∣|\dot{L}/\dot{M}|2.0441.958±0.0331.958 \pm0.033
∣(E˙−M˙)/M˙∣|(\dot{E}-\dot{M})/\dot{M}|0.3310.047±0.0090.047 \pm0.009

Table 2. Horizon diagnostics for the FUGUE simulation at 1923192^3 resolution. Maximum values are taken over the full run, while ⟨⋅⟩\langle\cdot\rangle denotes averages over 5000≤t/tg≤100005000 \le t/t_g \le10000 with standard deviations.

O. Porth et al. [70]. Throughout the evolution, entropy fallback was used in ∼0.13%\sim0.13\% of cells, and not a single cell required the averaging procedure discussed in Sect. 5.3.

Monopole and multipole self-gravity tests

After testing the GRMHD solver, we proceed to test the implementation of the self-gravity module. In the code, the multipole Poisson solver operates in modified Kerr–Schild coordinates (J. C. McKinney & C. F. Gammie [56]; S. C. Noble et al. [63]), which introduce a logarithmic radial grid and the parameter hh responsible for a denser grid in the equatorial region (Eq. (10)). In the following tests, we validate our solver using h=0.3h = 0.3, creating more difficult conditions for the solver than a uniform grid. We test convergence for N∈{16,32,64,128,256}N \in\{16, 32, 64, 128, 256\}, keeping three-dimensional resolution as N3N^3. The density distribution, given by an analytical profile, should give a pure monopole (ℓ=0\ell= 0, m=0m = 0) potential. The density profile is as follows:

ρ(r)=ρ0(r/r0)−q,(55)\rho(r) = \rho_0 (r/r_0)^{-q}, \tag*{(55)}

where q=1q = 1, r0=10r_0 = 10, and ρ0=1\rho_0 = 1. We compare the analytical potential Φ\Phi and its gradient, calculated using Eq. (24) with the reconstructed potential obtained using the Poisson solver. We calculate the relative L1L_1 errors of these values. We use two configurations of our solver: a purely monopole solver (ℓmax⁡=mmax⁡=0\ell_{\max} = m_{\max} = 0), and the multipole configuration (ℓmax⁡=mmax⁡=16\ell_{\max} = m_{\max} = 16). In Figure 11, the convergence test of the monopole is shown. For a purely monopole gravitational field, we observe second-order convergence for both setups. The higher-order multipoles used in this test can reconstruct the gravitational monopole almost as accurately as the monopole solver; however the potential gradient is slightly more accurate with the monopole configuration.

Figure 11. Convergence tests of the self-gravity Poisson solver, showing the relative L1L_1 errors of the gravitational potential Φ\Phi and its gradient ∥∇Φ∥\lVert\nabla\Phi\rVert. In the top panel, both the monopole and multipole configurations show second-order convergence for the monopole test. In the bottom panel, the multipole solver converges for the multipole test, whereas the monopole solver cannot fully reproduce the non-spherical field. Dashed lines indicate second-order convergence.

The main motivation for using the multipole Poisson solver is to go beyond the monopole treatment of self-gravity used in our previous studies ([41] (P. Płonka & A. Janiuk 2026)). The monopole solver includes only the spherically symmetric part of the gravitational potential. It cannot describe non-spherical structures, such as spiral density waves or thin disks.

As a second test here, we use a density distribution similar to that used in the monopole test; however, it is multiplied by spherical harmonics, which introduces dependence on the azimuthal and polar angles. We use the following distribution:

ρ(r,θ,ϕ)=ρ0(r/r0)−q[1+Re⁡{Y84(θ,ϕ)}],(56)\rho(r,\theta,\phi) = \rho_0(r/r_0)^{-q}\left[1 + \operatorname{Re}\{Y_{84}(\theta,\phi)\}\right], \tag*{(56)}

where Y84Y_{84} is the spherical harmonic with ℓ=8\ell= 8 and m=4m = 4. Then, we compare the analytical solution with the numerical result obtained using the multipole solver. The bottom panel of Figure 11 shows the convergence test. First, we observe the expected behaviour of the monopole solver in the multipole scenario: expected lack of convergence, with the error curve becoming flat. It shows that the solver is unable to reproduce higher-order multipoles. However, with the multipole solver, we obtain convergence close to the second order as the resolution increases.

Self-gravitating star

We now test the coupling between hydrodynamics and self-gravity introduced through the source term in the energy–momentum equation (Eq. (27)). We set the black hole mass and its spin to zero and initialize the analytical hydrostatic equilibrium profile of a star, given by the Lane–Emden polytropic model. Without self-gravity, such a star should start to expand due to pressure. We choose h=0.3h = 0.3 for the coordinate transformation in MKS (Eq. (10)), which additionally tests equilibrium in non-uniform coordinates. The HLLE Riemann solver with PPM reconstruction is chosen, and the Courant factor is set to CFL =0.8= 0.8. For this unmagnetized test, we set σ=ρ\sigma= \rho and keep only the rest-mass term in Tμν\mathcal{T}^{\mu\nu} (Eq. (26)), including the relativistic projection. For this test, we choose a polytropic index n=1n = 1 for which the Lane–Emden equation simplifies to a linear differential equation. The analytical formulae for the density and pressure are given by the following equations:

ρ(r)=ρcsin⁡(πr/R⋆)πr/R⋆,p(r)=2R⋆2πρ2(r),(57)\rho(r) = \rho_c \frac{\sin(\pi r/R_\star)}{\pi r/R_\star}, \qquad p(r) = \frac{2R_\star^2}{\pi}\rho^2(r), \tag*{(57)}

where ρc=10−4\rho_c = 10^{-4} is the central density and R⋆=10R_\star= 10 is the stellar radius. We test the numerical balance between pressure and gravity. We evolve the star without any perturbation and we measure the absolute L1L_1 errors of the density, internal energy, and radial velocity with respect to the initial state up to t=10t = 10. The idea of this test is similar to the Fishbone–Moncrief stability test in Sect. 6.9. In Figure 12 we show the absolute L1L_1 errors of the density, radial velocity, and internal energy. They decrease approximately at second order. We emphasize that this is not a Tolman–Oppenheimer–Volkoff test and does not model a fully relativistic star.

Figure 12. Convergence test for the self-gravitating polytropic star. The figure shows the L1L_1 errors of the primitive variables ρ\rho, uu, and uru^r as a function of the grid resolution NN. The star is evolved without perturbations to test whether the coupling between the stress-energy tensor and the self-gravity solver preserves the initial hydrostatic equilibrium. The black dashed line indicates second-order convergence.

Evrard collapse

The final self-gravity test checks the energy conservation. In general, the implementations of self-gravity using source terms do not conserve the total energy with machine precision [43]. We use the Evrard collapse test [19] to check how our code handles the conversion of gravitational energy into kinetic and thermal energy. The density profile of a spherical Evrard cloud is given by:

ρ(r)={M⋆2πR⋆2r,r≤R⋆,ρatm,r>R⋆.(58)\rho(r) = \begin{cases} \frac{M_\star}{2\pi R_\star^2 r}, & r \le R_\star, \\ \rho_{\mathrm{atm}}, & r > R_\star. \end{cases} \tag*{(58)}

where M⋆=R⋆=1M_\star= R_\star= 1, and the density of the atmosphere ρatm=10−7\rho_{\mathrm{atm}} = 10^{-7}. The evolution of collapse is followed up to τ=tη/R⋆=3\tau= t\sqrt{\eta}/R_\star= 3. The Poisson source is multiplied by η=10−4\eta= 10^{-4} to reduce the gravitational potential. The ideal gas equation of state is used with the adiabatic index γad=5/3\gamma_{\mathrm{ad}} = 5/3. We use Minkowski spacetime, and reflective boundary conditions to prevent mass loss through the domain boundaries. The internal, kinetic, and gravitational potential energies are computed using non-relativistic approximations. We use a resolution of Nr×Nθ=1024×1024N_r \times N_\theta= 1024 \times1024. We use the HLLE Riemann solver, with the PPM method for the reconstruction.

In Figure 13 we show the exchange of energy between the gravitational field, kinetic motion, and thermal energy during the collapse (top panel). The maximum

Figure 13. Energy conservation in the Evrard collapse test. The plot shows the gravitational, kinetic, thermal, and total energies over time. Because self-gravity is included through source terms, the total energy is not conserved to machine precision, but the error remains below one percent.

error of the total energy conservation (bottom panel) is ΔE/∣E0∣×100%≲0.45%\Delta E/|E_0| \times100\% \lesssim0.45\%. This value is comparable to that reported for a self-gravity module in the PLUTO code [55]. Therefore, we conclude that our code can conserve the total energy to better than one percent in the collapse scenario.

Implementation and Performance

CUDA kernels and implementation

FUGUE is a GPU-accelerated CUDA C++ code for high-performance calculations on NVIDIA GPUs. The code has a procedural, kernel-oriented CUDA design. The code supports multi-node communication using CUDA-aware MPI, with domain decomposition along all three spatial dimensions. Halo data are packed and unpacked by dedicated CUDA kernels. The core of the code is based on the CPU version of HARM [24, 63]. The metric-update method follows our previous works [42] (D. L. Król & A. Janiuk 2021) and is implemented on GPUs. Additionally, we implement a weak-field self-gravity module using the spherical harmonic Poisson solver. Near the polar axis, the azimuthal cell size becomes very small, leading to very small timesteps. To avoid this, we optionally implement cylindrified coordinates similar to those in HARMPI1. The cylindrification increases the cell size near the polar axis and allows larger timesteps.

The schematic of the FUGUE kernel workflow is shown in Figure 14. A standard single-domain GRMHD timestep involves more than 30 CUDA kernel launches, excluding MPI, self-gravity, and metric updates. The code implements the second-order Runge–Kutta (RK2) scheme for global evolution (Eq. (46)), as well as time-dependent metric evolution (Sect. 3) and the self-gravity module (Sect. 4). In the normal stationary spacetime scenario, the code calculates the geometry, e.g., metric components, connection coefficients, and determinant at the beginning. The code takes advantage of the fact that the Kerr metric is axisymmetric (Eq. (9)), and stores only one slice from three-dimensional grid in global memory. Because all geometric values are calculated on only one slice, the computational cost of refreshing geometry during metric update is small compared to the full three-dimensional GRMHD update.

Simplified execution flow in FUGUE

Figure 14. Simplified execution flow in FUGUE. The RK2 block is executed twice, first to construct the half-step state and then to perform the full-step update. Each stage includes interface reconstruction, flux calculation and correction, constrained transport (CT), conservative evolution, primitive-variable recovery, numerical fixups, boundary treatment, and MPI halo exchange. The Kerr metric evolution and multipole self-gravity operations are optional.

When metric update is enabled, the code calculates and refreshes the geometry at every RK2 step (Eq. (46)). The metric update is made before recovering the primitive variables, to consistently adjust conserved variables (Eq. (31)) to the new geometry. The HLLE/Lax–Friedrichs fluxes (Eq. (34) and Eq. (37)) at the inner boundary are used to determine the energy and angular-momentum accretion rates for metric update. In the code, we evolve the black hole mass and angular momentum using RK2, and recover the dimensional spin after each update. This treatment correctly balances the conservation of energy and momentum in the simulation domain. The metric update works with either prograde (a>0a > 0) or retrograde (a<0a < 0) black hole spin configurations. The code can start with a Schwarzschild black hole and gradually spin it up, producing a rotating Kerr black hole.

We tested the summation of the energy and angular-momentum fluxes for all these configurations. The resulting changes in the black hole mass and angular momentum agree with the integrated inner-boundary fluxes to round-off errors. The quasi-stationary metric update was previously implemented and used in our CPU studies ([42, 41, 73] (D. Ł. Król & A. Janiuk 2021)). Here, the implementation is different as we add a source term (Eq. (16)) in the energy when the metric is updated. The source term can be neglected, only when the fractional changes of the black hole mass and spin over a dynamical timescale are small. To enhance the code’s performance, we store slices of two derivatives (Eq. (17)) to global memory, and the source term is added during update (Eq. (28)), when the usual geometrical sources are added.

The Poisson solver is second order in time. The additional four-force (Eq. (30)) from self-gravity is applied during the update of conserved variables (Eq. (28)). In the Poisson solver, the spherical harmonics and values associated with them are precomputed and saved in the global memory. Following the method described in [10], we precompute values of harmonics in the cell centers and on the cell interfaces. We read them at every iteration while making a projection of effective density onto the spherical harmonics (Eq. (20)). Importantly, the entire Poisson solver operates in the MKS coordinates. We also tested the self-gravity module in magnetized flows using the full active source, and the complete passive response tensor. In these tests, the four-force remained orthogonal to the fluid four-velocity, and the evolution is numerically stable.

In FUGUE, we save the maximum values of the gravitational potential and divergence at intervals similar to those used for the mass accretion rate and other diagnostic parameters. We tested various scenarios, and we did not detect any problem in terms of divergence preservation, independently of the presence of the quasi-stationary evolving spacetime. For data output we use the HDF5 format, and a single file is saved from all tasks in MPI processes. The code also supports restarts. We have tested the code on several generations of NVIDIA

The schematic of the FUGUE kernel workflow is shown in Figure 14.

Performance and scalability

While developing FUGUE, we paid attention to performance. In contrast to the implementation presented by D. Bégué et al. [3], we do not use shared memory, and as a goal, we minimize register usage to increase occupancy. The kernels are optimized to avoid register spilling. We use a structure-of-arrays (SoA) memory layout, which improves memory access on GPUs. When possible, we use 32-bit indices, making index calculations faster without changing the precision of physical variables. Another optimization is that the metric, inverse metric, metric determinant, and Christoffel symbols are precomputed before the simulation and stored in GPU memory. Spherical harmonics are also computed before the simulation. Minor improvements like the minimum CFL time step (Eq. (43)) is first calculated inside each warp are implemented. Importantly, the code uses only double precision for the physical variables and for the Poisson solver. In Table 3 we present the relative kernel times for a three-dimensional simulation setup with the resolution 2563256^3 using Fishbone–Moncrief torus on an NVIDIA TITAN V. The solver is HLLE with the PPM method as the reconstruction scheme. The most demanding kernels are responsible for the flux calculations. The kernels for all three directions take about 50% of the total computation time. The second most demanding kernel updates the conserved variables and includes all geometrical source terms, taking about 20% of the total computation time. The primitive variable recovery kernel is next with about 16% relative cost.

Kernel groupTime [%]
Flux calculation50.7
Update with geometric source terms20.1
Primitive recovery and corrections15.8
Constrained-transport update7.9
Boundary and polar corrections1.2
Diagnostics and other kernels4.3

Table 3. Relative CUDA kernel cost for the PPM reconstruction method with the RK2 time integrator on an NVIDIA TITAN V. The code uses the general-relativistic magnetohydrodynamics solver, without self-gravity or metric evolution. The resolution of the test is set to 2563256^3, with a Fishbone–Moncrief torus.

We used NVIDIA Nsight Compute on an NVIDIA TITAN V to check how the main kernels use GPU compute resources and memory bandwidth. The average Compute (SM) Throughput and DRAM Throughput were

48% and 27% for flux calculation, 15% and 69% for the conserved variable update, and 46% and 58% for primitive recovery. These values may differ on other GPUs.

In terms of performance, FUGUE achieves values similar to those of state-of-the-art codes like H-AMR ([52]). In Figure 15, we present the performance comparison (in zone-cycles s−1^{-1}) for a few different NVIDIA GPUs, where one zone-cycle means one cell completes a full timestep, including both RK2 stages. We take into account only active cells. Using PLM reconstruction with the MINMOD limiter, our code achieves more than 470 million zone-cycles per second on a single NVIDIA GH200 GPU. The code with the Poisson solver set to ℓmax⁡=mmax⁡=16\ell_{\max}=m_{\max}=16 achieves 156 million zone-cycles per second on an NVIDIA GH200, with PPM as the reconstruction method.

Figure 15. Zone-cycle performance for different single NVIDIA GPUs. The benchmark uses a 2563256^3 Fishbone–Moncrief torus and RK2 time integration. The code solves the pure GRMHD equations, without self-gravity or metric evolution. The values are in units of 10610^6 zone-cycles s−1^{-1}. GPUs, including Hopper, Ampere, Volta, and Kepler, showing the portability of the code across generations of GPUs.

We tested the MPI scalability of the code. In Figure 16, we present a weak scaling test on NVIDIA A100 40GB GPUs (8 cards per node). We use a resolution of 2563256^3 cells per GPU with the magnetized Fishbone–Moncrief torus. The Riemann solver is chosen as the HLLE, with the PPM method as the reconstruction method. We achieved an efficiency of approximately 79% for 64 GPUs across 8 nodes. We performed similar tests on 32 NVIDIA GH200 GPUs (4 cards per node) obtaining 81% weak scaling efficiency in comparison to a single graphics card.

Figure 16. Weak scaling on NVIDIA A100 40GB GPUs, using a resolution of 2563256^3 cells per GPU with a Fishbone–Moncrief torus. The top axis shows the number of nodes. The labels indicate the MPI decomposition. The efficiency remains about 80% at 64 GPUs.

Limitations

The self-gravity module is a weak-field prescription on top of the Kerr background. This model is an effective weak-field approximation and is not a full solution of the Einstein equations. It implements a scalar Poisson solver, and applies a projected four-force. In the Poisson solver, we use auxiliary spherical coordinates, which introduces a spin-dependent error relative to oblate coordinates. The next numerically intented simplification is the usage of a flat Poisson solver (Eq. (18)). The solver in curved spacetime is far more computationally expensive. Another approximation is the instantaneous response of the self-gravity field. A potential solution to this problem is to evolve the self-gravity potential with a hyperbolic wave-equation solver (R. Hirai et al. [35]), which is beyond the scope of this work. Nevertheless, we note it as a potential improvement.

Importantly, it does not mean that the dynamics has the same relative errors. Near the black hole, the self-gravity source is much smaller than the geometrical momentum source, χ=∥Gi∥/∥TκλΓλκi∥≪1\chi= \lVert G_i \rVert/ \lVert T^{\kappa\lambda}\Gamma^\lambda{}_{\kappa i}\rVert\ll1; therefore, errors in the self-gravity force should have only a small local effect in this region. We note that the diagnostic χ\chi is a coordinate- and slicing-dependent. For a test, we initialized the 16TI progenitor model (S. E. Woosley & A. Heger [96]; G. Urrutia et al. [93]) with a stellar mass of M⋆=13.95 M⊙M_\star= 13.95\,M_\odot and a black hole mass of MBH=3 M⊙M_{\rm BH} = 3\,M_\odot. Using shell-integrated norms, for r<10rgr < 10r_g, we obtained χ<10−3\chi< 10^{-3}. A small value of χ\chi only shows that self-gravity is small compared with the geometric source near the black hole. We note that individual geometric, centrifugal, pressure or magnetic terms in the χ\chi diagnostic can be partially canceled, so χ\chi should be interpreted only as an approximate diagnostic. In addition to limitations, the multipole expansion is centered on the black hole, unlike in (S. M. Couch et al. [10]), and matter outside the domain is neglected.

In our implementation, the surrounding matter can be more massive than the black hole if its gravitational potential is still weak, ∣Φ∣≪1\lvert\Phi\rvert\ll1. However, if the matter distribution is strongly asymmetric, the black hole frame is not inertial frame of reference. This effect is included with the indirect potential from the ℓ=1\ell= 1 modes. It will be studied in detail in the subsequent studies. The accuracy of the four-force prescription for relativistic flows

remains to be tested against solutions with dynamical spacetime.

Toomre-unstable self-gravitating accretion disk

The development of the code is primarily motivated by collapsar simulations or massive accretion disks around black holes. Potentially, the collapsar neutrino-cooled disk can be gravitationally unstable (Y.-X. Chen & B. D. Metzger [7]). The fixed-background GRMHD simulations (O. Gottlieb et al. [29]) cannot capture gravitational instabilities. Simulations in dynamical spacetime can capture the growth of non-axisymmetric modes (O. Korobkin et al. [48]; E. Wessel et al. [94]); however, such simulations are extremely computationally expensive, which makes them nowadays impractical for long-term and large-scale simulations.

As a demonstrative model for FUGUE, we initialize two setups: one with self-gravity and one without. The mass of the accretion disk is set to Mdisk=1 M⊙M_{\rm disk} = 1\,M_\odot, while the mass of the black hole is chosen to be MBH=3 M⊙M_{\rm BH} = 3\,M_\odot, with the spin a⋆=0.8a_\star= 0.8, and h=0.3h = 0.3. The disk scale height is set to a very thin value H/R=0.015H/R = 0.015. The disk has a Keplerian profile of angular velocity. The surface density is given by Σ∝R−2\Sigma\propto R^{-2}, and the vertical density profile is assumed to be Gaussian. The poloidal magnetic vector potential is set as Aϕ∝ρA_\phi\propto\rho, and then the magnetic field is normalized to the plasma beta β=100\beta= 100 at r=12.5 rgr = 12.5\,r_g. The outer radius is set to rout=300 rgr_{\rm out} = 300\,r_g. The equation of state is the ideal gas, with the adiabatic index γad=4/3\gamma_{\rm ad} = 4/3. For the adopted MKS mapping with h=0.3h = 0.3, the disk vertical thickness is resolved by approximately eight θ\theta-cells across 2H2H at r=12.5 rgr = 12.5\,r_g. This demonstrative model is intended to capture global gravitational instabilities (GI) rather than fully resolved MRI turbulence. We apply small perturbations to break symmetry in the hydrodynamic variables in order to seed gravitational instabilities. The disk is initially assumed to be Toomre unstable (A. Toomre [91]), according to the criterion

Q≡csκπGΣ,(59)Q \equiv\frac{c_s\kappa}{\pi G\Sigma}, \tag*{(59)}

where csc_s is the local sound speed, κ\kappa is the epicyclic frequency, and Σ\Sigma is the disk surface density. We initialize the disk with a value Q∼1/3Q \sim1/3. We do not include any cooling source term during the evolution. Our disk is Toomre unstable initially, and over time, it can self-regulate by heating. The self-consistent effect of physical neutrino cooling will be the subject of further research (M. Shibata et al. [82]; D. Radice et al. [74]). The resolution of the simulations is set to (Nr×Nθ×Nϕ)=(256×256×128)(N_r \times N_\theta\times N_\phi) = (256 \times256 \times128), and truncation of spherical harmonic solver set to ℓmax⁡=mmax⁡=16\ell_{\max} = m_{\max} = 16. We note that such values in the Poisson solver are too small for local disk fragmentation; nevertheless they can amplify global non-axisymmetric structures. The metric is updated quasi-stationarily during the evolution, as described in Sect. 3. As a diagnostic, we use a several

physical quantities. We calculate the mass accretion rate through the black hole event horizon:

M˙=−∫02π∫0πρur−g dθ dϕ∣r=rH.(60)\dot{M} = -\left.\int_{0}^{2\pi}\int_{0}^{\pi} \rho u^{r}\sqrt{-g}\,d\theta\,d\phi\right|_{r=r_{\mathrm{H}}}. \tag*{(60)}

Next, we calculate the magnetic flux ΦBH\Phi_{\mathrm{BH}} threading the black hole given by:

ΦBH=12∫02π∫0π∣Br∣−g dθ dϕ∣r=rH.(61)\Phi_{\mathrm{BH}} = \left.\frac{1}{2}\int_{0}^{2\pi}\int_{0}^{\pi} \lvert B^{r}\rvert\sqrt{-g}\,d\theta\,d\phi\right|_{r=r_{\mathrm{H}}}. \tag*{(61)}

where BrB^{r} is the radial component of the magnetic field. We measure the electromagnetic luminosity by calculating the Blandford–Znajek power, given by:

LBZ=−∫02π∫0π(T tr)EM−g dθ dϕ∣r=rH.(62)L_{\mathrm{BZ}} = -\left.\int_{0}^{2\pi}\int_{0}^{\pi} (T^{r}_{\ t})_{\mathrm{EM}}\sqrt{-g}\,d\theta\,d\phi\right|_{r=r_{\mathrm{H}}}. \tag*{(62)}

We also define the volume-integrated amplitude of the mm-th azimuthal Fourier modes (K. Kiuchi et al. [46]), given by:

Dm=∫rHrout∫0π∫02πρute−imϕ−g dϕ dθ dr.(63)D_m = \int_{r_{\mathrm{H}}}^{r_{\mathrm{out}}}\int_{0}^{\pi}\int_{0}^{2\pi} \rho u^{t}e^{-im\phi}\sqrt{-g}\,d\phi\,d\theta\,dr. \tag*{(63)}

In Figure 17 we show the evolution of the Toomre unstable disk at three times: t=2000 tgt = 2000\,t_g, t=5000 tgt = 5000\,t_g, and t=10000 tgt = 10000\,t_g. The disk in the presence of self-gravity is expected to amplify non-axisymmetric modes or fragment from the innermost regions. The amplification is also visible in the poloidal slices, where inside the spiral arms the disk is thicker. In Figure 18, we present the mass accretion rate M˙\dot{M} (Eq. (60)), magnetic flux threading the black hole ΦBH\Phi_{\mathrm{BH}} (Eq. (61)), and the Blandford–Znajek luminosity LBZL_{\mathrm{BZ}} (Eq. (62)). We note that for t<1750tgt < 1750t_g the larger mass accretion rate M˙∼0.1 M⊙ s−1\dot{M} \sim0.1\,M_\odot\,\mathrm{s}^{-1} is related to the changes in the effective potential. The disk is massive, and because the initial velocity was Keplerian, when self-gravity is included, the system needs to adjust to a new distribution of the angular velocity which is changing for an effective gravitational potential, given by the sum of black hole and disk masses. During this process, the magnetic flux is not accumulated. Then, after about t>2000tgt > 2000t_g, the larger mass accretion rate is related to the episodic inflow pulses due to disk instability, with strong episodic spikes, observed at t∼3000tgt \sim3000t_g, t∼5000tgt \sim5000t_g, and t∼7000tgt \sim7000t_g. An important effect of the model is that during episodic mass accretion, the magnetic flux on the event horizon is larger, and the Blandford–Znajek luminosity grows as well. This is shown in Figure 18 with gray shaded regions. It suggests that in a physically consistent scenario, when the disk is unstable, during episodic mass accretion the electromagnetic power can be modulated, potentially affecting the variability of the jet and as a consequence gamma-ray burst emission properties. This effect will be the subject of our separate future studies.

Density maps for a Toomre-unstable disk

Figure 17. The maps of density ρ\rho (g cm−3^{-3}) for a Toomre unstable disk in the model including self-gravity. On the top panel, equatorial maps are shown, and on the bottom, poloidal slices are displayed. Over time, for t=2000 tgt = 2000\,t_g, t=5000 tgt = 5000\,t_g, and t=10000 tgt = 10000\,t_g the growth of non-axisymmetric structures is shown, starting from the regions with larger angular velocity in the vicinity of the black hole, and then to further regions. These figures show that FUGUE is able to track gravitational instabilities.

Figure 18. Time evolution of the mass accretion rate M˙\dot{M}, magnetic flux threading the black hole ΦBH\Phi_{\mathrm{BH}}, and Blandford–Znajek luminosity LBZL_{\mathrm{BZ}} for models with and without self-gravity. The blue and orange lines correspond to the self-gravitating and non-self-gravitating models, respectively. Periods of stronger accretion are followed by higher LBZL_{\mathrm{BZ}}, suggesting that changes in the accretion flow may affect the jet power, potentially affecting prompt emission of GRBs.

To quantify the non-axisymmetric disk structure, we use the total normalized Fourier-mode power, given by:

P(t)=∑m=116∣Dm(t)D0(t)∣2,(64)\mathcal{P}(t) = \sum_{m=1}^{16} \left|\frac{D_m(t)}{D_0(t)}\right|^2, \tag*{(64)}

where the sum includes modes from m=1m = 1 to m=16m = 16. In the model without self-gravity this quantity is approximately P∼10−4\mathcal{P} \sim10^{-4}, and the initial perturbations are damped. In the presence of self-gravity, they are amplified, and the total power is about a hundred times larger, with a value of P∼10−2\mathcal{P} \sim10^{-2} throughout the simulation time. After t∼10 000tgt \sim10\,000t_g, the disk gradually becomes gravitationally stable from the innermost regions due to progressive heating, and the differences between the model with self-gravity and the one without it start to disappear, as shown in Figure 18.

We present the evolution of the central black hole mass and dimensionless spin in Figure 19. The accretion disk spins up the black hole, and the evolution of the spin and mass is highly correlated. Because of the larger mass and angular momentum accretion, the black hole spins up faster in the presence of self-gravity. We note that throughout the evolution ∣ΦSG∣<10−2|\Phi_{\mathrm{SG}}| < 10^{-2}, so the disk generates weak-field self-gravity even during the strong mode amplification. The indirect potential from the ℓ=1\ell= 1 coefficients was not included in these simulations. Its effect ([58, 75]), especially on the m=1m = 1 mode and variability, will be studied in future work.

Figure 19. Time evolution of black hole mass MBHM_{\mathrm{BH}} and dimensionless spin α∗\alpha_* for models with and without self-gravity.

Conclusions

We have presented FUGUE, a new GPU-accelerated code for general relativistic magnetohydrodynamics (Sect. 2). The code implements an optional quasi-stationary Kerr black hole mass and spin evolution (Sect. 3) and weak-field multipole self-gravity (Sect. 4). First and foremost, the code is a standard GRMHD code, optimized for HPC computing on NVIDIA GPUs. The performance of the code is comparable in terms of values of zone-cycles reported in other state-of-the-art GPU codes ([52, 67]), and because of the code’s specialization, it is substantially faster than codes for dynamical spacetime, when those codes are used in a stationary spacetime scenario ([79, 44]). The current implementation of FUGUE uses a fixed grid approach and does not include adaptive mesh refinement (AMR).

FUGUE is a highly optimized code for solving the GRMHD equations. We validated the code across many numerical tests, including from shock tubes (Sect. 6.1 and Sect. 6.3), Kelvin–Helmholtz instabilities (Sect. 6.2), through the magnetic rotator (Sect. 6.6), blast wave (Sect. 6.5), and advective loop (Sect. 6.7). The general relativistic solver was validated with Michel–Bondi accretion (Sect. 6.8) and the Fishbone–Moncrief torus (Sect. 6.9). We compare results from FUGUE with state-of-the-art GRMHD codes (Sect. 6.10). The Poisson solver was validated by testing its calculation of the gradient and potential for multipole and monopole scenarios (Sect. 6.11). The convergence tests show second-order accuracy. As a demonstration scientific result, we showed that during the phase when the disk is gravitationally unstable, the mass accretion rate is more variable, and it also affects the Blandford–Znajek luminosity. These effects may influence the variability and emission properties of gamma-ray bursts; however, determining whether disks in collapsars are actually gravitationally unstable requires self-consistent simulations like D. Issa et al. [37] supplemented with self-gravity.

The code implements multipole self-gravity using a few simplifications. The main one is the weak-field requirement. However, after the formation of a black hole in collapsar simulations (e.g., G. Urrutia et al. [93]), the gravitational potential generated by the fluid is relatively weak. The main approximations are the use of a flat Poisson solver, the prescribed self-gravity four-force, and the neglect of retardation effects. However, in the regime for which the code is designed, these errors are the largest in the regions where the effects of self-gravity on dynamics are subdominant (Sect. 7.3); nevertheless the dynamical effects depends on physical conditions.

The new code is primarily developed for our future collapsar studies. In long-duration 3D simulations, the effects of self-gravity can change the system evolution significantly ([41] (P. Płonka & A. Janiuk 2026)). Self-gravity reduces the dynamical timescale; hence, the collapse of a star proceeds faster. During a strong MAD state, the black hole spin-down should lead to an equilibrium within tens of seconds ([39, 38]). Our code, FUGUE, allows us to track the process of achieving spin equilibrium dynamically and very efficiently.

Another application of this code is the formation of non-axisymmetric structures associated with gravitational instabilities, which can efficiently transport angular momentum and produce high, variable accretion rates (P. A. Taylor et al. [88]). The effects of mass accretion variability in the Toomre unstable disks were discussed in Sect. 8, as a science case demonstrating the applicability of our code to new problems. Such non-axisymmetric structures can be the source of gravitational waves ([7, 51]).

Our plan for future code development is to implement microphysics, such as that given by the nuclear (Helmholtz) tabulated equation of state (A. Janiuk et al. [40]). We also plan to introduce the M1 method for neutrino transport ([82, 74, 37]). These modifications are beyond the scope of the current article; however we highlight here the importance of nuclear physics and neutrino transport in the realistic collapsar simulations.

Acknowledgements

We thank Ore Gottlieb and Yuri Levin for interesting discussions on the monopole/multipole self-gravity and Mateusz Kapusta for helpful suggestions on improving the performance of the code. We thank the anonymous referee for helpful comments that improved our manuscript. This work has been partially supported by grant No. 2023/50/A/ST9/00527 from the Polish National Science Center. We gratefully acknowledge Polish high-performance computing infrastructure PLGrid (HPC Center: ACK Cyfronet AGH) for providing computer facilities and support within computational grant no. PLG/2026/019543

Magnetohydrodynamic inertial response tensor

We start with the magnetohydrodynamic stress-energy tensor (Eq. (6)), which is given by

Tμν=(w+b2)uμuν+(p+b22)gμν−bμbν,(65)T^{\mu\nu} = (w+b^2)u^\mu u^\nu+ \left(p+\frac{b^2}{2}\right)g^{\mu\nu} - b^\mu b^\nu, \tag*{(65)}

where the enthalpy density is defined as w≡ρ+u+pw \equiv\rho+ u + p. Taking the covariant divergence of Eq. (65), we obtain

∇μTμν=uν∇μ[(w+b2)uμ]+(w+b2)uμ∇μuν+∇ν(p+b22)−bν∇μbμ−bμ∇μbν.(66)\nabla_\mu T^{\mu\nu} = u^\nu\nabla_\mu\left[(w+b^2)u^\mu\right] + (w+b^2)u^\mu\nabla_\mu u^\nu+ \nabla^\nu\left(p+\frac{b^2}{2}\right) - b^\nu\nabla_\mu b^\mu- b^\mu\nabla_\mu b^\nu. \tag*{(66)}

We define the four-acceleration as aν≡uμ∇μuνa^\nu\equiv u^\mu\nabla_\mu u^\nu. Contracting the ideal-MHD induction equation (Eq. (1)) with uνu_\nu and using uμuμ=−1u_\mu u^\mu=-1 and uμbμ=0u_\mu b^\mu=0, we obtain the following relation between the divergence of the magnetic four-vector and the fluid four-acceleration, given by:

∇μbμ=bνaν.(67)\nabla_\mu b^\mu= b^\nu a_\nu. \tag*{(67)}

We project the energy-momentum equation onto the space orthogonal to the four-velocity using the projection tensor

h να=δ να+uαuν,hαν=gαν+uαuν.(68)h^\alpha_{\ \nu} = \delta^\alpha_{\ \nu} + u^\alpha u_\nu,\qquad h^{\alpha\nu} = g^{\alpha\nu} + u^\alpha u^\nu. \tag*{(68)}

Because h ναuν=0h^\alpha_{\ \nu}u^\nu= 0, the first term in Eq. (66) becomes zero after the projection. The four-acceleration is also perpendicular to the four-velocity, so uνaν=0u_\nu a^\nu= 0. Therefore, h ναaν=aαh^\alpha_{\ \nu}a^\nu= a^\alpha. The projected momentum equation is consequently

h να∇μTμν=(w+b2)aα+hαν∇ν(p+b22)−bα∇μbμ−h μαbν∇νbμ.(69)h^\alpha_{\ \nu}\nabla_\mu T^{\mu\nu} = (w+b^2)a^\alpha+ h^{\alpha\nu}\nabla_\nu\left(p+\frac{b^2}{2}\right)-b^\alpha\nabla_\mu b^\mu-h^\alpha_{\ \mu}b^\nu\nabla_\nu b^\mu. \tag*{(69)}

Using Eq. (67) and the orthogonality relation uνaν=0u^\nu a_\nu=0, so that aα=(gαν+uαuν)aνa^\alpha=(g^{\alpha\nu}+u^\alpha u^\nu)a_\nu, Eq. (69) can be written as

h να∇μTμν=[(w+b2)(gαν+uαuν)−bαbν]⏟Iανaν+hαν∇ν(p+b22)−h μαbμ∇μbν.(70)h^\alpha_{\ \nu}\nabla_\mu T^{\mu\nu}=\underbrace{\left[(w+b^2)(g^{\alpha\nu}+u^\alpha u^\nu)-b^\alpha b^\nu\right]}_{\mathcal{I}^{\alpha\nu}}a_\nu+h^{\alpha\nu}\nabla_\nu\left(p+\frac{b^2}{2}\right)-h^\alpha_{\ \mu}b^\mu\nabla_\mu b^\nu. \tag*{(70)}

The tensor Iαν\mathcal{I}^{\alpha\nu} contains the terms related to the four-acceleration and is called the magnetohydrodynamic inertial response tensor. The other terms describe the gas and magnetic pressure gradients and the magnetic tension.

References

  1. [1]Balsara, D. 2001, ApJS, 132, 83, doi: 10.1086/318941DOI
  2. [2]Balsara, D. S., & Spicer, D. S. 1999, Journal of Computational Physics, 149, 270, doi: 10.1006/jcph.1998.6153DOI
  3. [3]Bégue, D., Pe’er, A., Zhang, G.-Q., Zhang, B.-B., & Pevzner, B. 2023, ApJS, 264, 32, doi: 10.3847/1538-4365/aca276DOI
  4. [4]Blandford, R. D., & Znajek, R. L. 1977, MNRAS, 179, 433, doi: 10.1093/mnras/179.3.433DOI
  5. [5]Boyer, R. H., & Lindquist, R. W. 1967, Journal of Mathematical Physics, 8, 265, doi: 10.1063/1.1705193
  6. [6]Chan, H.-S., Ryu, T., Krolik, J., & Piran, T. 2026, ApJ, 1003, 221, doi: 10.3847/1538-4357/ae067fa
  7. [7]Chen, Y.-X., & Metzger, B. D. 2025, The Astrophysical Journal Letters, 991, L22, doi: 10.3847/2041-8213/ae045dDOI
  8. [8]Cheong, P. C.-K., Lin, L.-M., & Li, T. G. F. 2020, Classical and Quantum Gravity, 37, 145015, doi: 10.1088/1361-6382/ab8e9cDOI
  9. [9]Colella, P., & Woodward, P. R. 1984, Journal of Computational Physics, 54, 174, doi: 10.1016/0021-9991(84)90143-8DOI
  10. [10]Couch, S. M., Graziani, C., & Flocke, N. 2013, ApJ, 778, 181, doi: 10.1088/0004-637X/778/2/181DOI
  11. [11]Cusinato, M., Obergaulinger, M., & Aloy, M. Á. 2026, A&A, 705, A179, doi: 10.1051/0004-6361/202556543DOI
  12. [12]De Villiers, J.-P., Hawley, J. F., & Krolik, J. H. 2003, ApJ, 599, 1238, doi: 10.1086/379509
  13. [13]Del Zanna, L., Bucciantini, N., & Londrillo, P. 2003, A&A, 400, 397, doi: 10.1051/0004-6361:20021641
  14. [14]Del Zanna, L., Landi, S., Serafini, L., Bugli, M., & Papini, E. 2024, Fluids, 9, 16, doi: 10.3390/fluids9010016
  15. [15]Del Zanna, L., Zanotti, O., Bucciantini, N., & Londrillo, P. 2007, A&A, 473, 11, doi: 10.1051/0004-6361:20077093DOI
  16. [16]Ehlers, J., Ozsváth, I., Schücking, E. L., & Shang, Y. 2005, PhRvD, 72, 124003, doi: 10.1103/PhysRevD.72.124003DOI
  17. [17]Einfeldt, B. 1988, SIAM Journal on Numerical Analysis, 25, 294, doi: 10.1137/0725021
  18. [18]Event Horizon Telescope Collaboration, Akiyama, K., Alberdi, A., et al. 2019, ApJL, 875, L1, doi: 10.3847/2041-8213/ab0ec7
  19. [19]Evrard, A. E. 1988, MNRAS, 235, 911, doi: 10.1093/mnras/235.3.911DOI
  20. [20]Fedrigo, G., & Lupi, A. 2025, A&A, 700, A112, doi: 10.1051/0004-6361/202554291DOI
  21. [21]Fishbone, L. G., & Moncrief, V. 1976, ApJ, 207, 962, doi: 10.1086/154565DOI
  22. [22]Friedrichs, K. O. 1954, Communications on Pure and Applied Mathematics, 7, 345, doi: 10.1002/cpa.3160070206DOI
  23. [23]Fujibayashi, S., Sekiguchi, Y., Shibata, M., & Wanajo, S. 2023, ApJ, 956, 100, doi: 10.3847/1538-4357/acf5e5DOI
  24. [24]Gammie, C. F., McKinney, J. C., & Tóth, G. 2003, ApJ, 589, 444, doi: 10.1086/375494
  25. [25]Gammie, C. F., Shapiro, S. L., & McKinney, J. C. 2004, ApJ, 602, 312, doi: 10.1086/380996DOI
  26. [26]Garat, A., & Price, R. H. 2000, PhRvD, 61, 124011, doi: 10.1103/PhysRevD.61.124011DOI
  27. [27]Gardiner, T. A., & Stone, J. M. 2005, Journal of Computational Physics, 205, 509, doi: 10.1016/j.jcp.2004.11.016DOI
  28. [28]Giacomazzo, B., & Rezzolla, L. 2006, Journal of Fluid Mechanics, 562, 223, doi: 10.1017/S00221120060001145
  29. [29]Gottlieb, O., Lalakos, A., Bromberg, O., Liska, M., & Tchekhovskoy, A. 2022a, MNRAS, 510, 4962, doi: 10.1093/mnras/stab3784DOI
  30. [30]Gottlieb, O., Levinson, A., & Levin, Y. 2024, ApJL, 972, L4, doi: 10.3847/2041-8213/ad697cDOI
  31. [32]Gourgoulhon, E. 2007, arXiv e-prints, gr, doi: 10.48550/arXiv.gr-qc/0703035DOI
  32. [33]Harten, A., Lax, P. D., & van Leer, B. 1983, SIAM Review, 25, 35, doi: 10.1137/1025002DOI
  33. [34]Hayashi, K., Kiuchi, K., Kyutoku, K., Sekiguchi, Y., & Shibata, M. 2025, PhRvL, 134, 211407, doi: 10.1103/PhysRevLett.134.211407DOI
  34. [35]Hirai, R., Nagakura, H., Okawa, H., & Fujisawa, K. 2016, PhRvD, 93, 083006, doi: 10.1103/PhysRevD.93.083006DOI
  35. [36]Hwang, J.-c., & Noh, H. 2016, ApJ, 833, 180, doi: 10.3847/1538-4357/833/2/180DOI
  36. [37]Issa, D., Gottlieb, O., Metzger, B. D., et al. 2025, ApJL, 985, L26, doi: 10.3847/2041-8213/adc694DOI
  37. [38]Issa, D., Lowell, B., Jacquemin-Ide, J., Liska, M., & Tchekhovskoy, A. 2026, PhRvD, 113, 083020, doi: 10.1103/fzhd-hcppDOI
  38. [39]Jacquemin-Ide, J., Gottlieb, O., Lowell, B., & Tchekhovskoy, A. 2024, ApJ, 961, 212, doi: 10.3847/1538-4357/ad02f0
  39. [40]Janiuk, A., Saji, J., & Urrutia, G. 2026, A&A, 707, A307, doi: 10.1051/0004-6361/202557832DOI
  40. [41]Janiuk, A., Shahamat Dehshorkh, N., & Król, D. Ł. 2023, A&A, 677, A19, doi: 10.1051/0004-6361/202245610DOI
  41. [42]Janiuk, A., Sukova, P., & Palit, I. 2018, ApJ, 868, 68, doi: 10.3847/1538-4357/aae83fDOI
  42. [43]Jiang, Y.-F., Belyaev, M., Goodman, J., & Stone, J. M. 2013, NewA, 19, 48, doi: 10.1016/j.newast.2012.08.002DOI
  43. [44]Kalinani, J. V., Ji, L., Ennoggi, L., et al. 2025, Classical and Quantum Gravity, 42, 025016, doi: 10.1088/1361-6382/ad9c11DOI
  44. [45]Kastaun, W., Kalinani, J. V., & Ciolfi, R. 2021, PhRvD, 103, 023018, doi: 10.1103/PhysRevD.103.023018DOI
  45. [46]Kiuchi, K., Shibata, M., Montero, P. J., & Font, J. A. 2011, PhRvL, 106, 251102, doi: 10.1103/PhysRevLett.106.251102DOI
  46. [47]Komissarov, S. S. 1999, MNRAS, 303, 343, doi: 10.1046/j.1365-8711.1999.02244.xDOI
  47. [48]Korobkin, O., Abdikamalov, E. B., Schnetter, E., Stergioulas, N., & Zink, B. 2011, PhRvD, 83, 043007, doi: 10.1103/PhysRevD.83.043007DOI
  48. [50]Lax, P. D. 1954, Communications on Pure and Applied Mathematics, 7, 159, doi: 10.1002/cpa.3160070112DOI
  49. [51]Lerner, Y., Stone, N. C., & Ofengeim, D. D. 2026, MNRAS, 545, staf1835, doi: 10.1093/mnras/staf1835DOI
  50. [52]Liska, M. T. P., Chatterjee, K., Issa, D., et al. 2022, ApJS, 263, 26, doi: 10.3847/1538-4365/ac9966DOI
  51. [53]Lowell, B., Jacquemin-Ide, J., Liska, M., & Tchekhovskoy, A. 2025, PhRvD, 112, 123023, doi: 10.1103/q956-3wr5DOI
  52. [54]Lowell, B., Jacquemin-Ide, J., Tchekhovskoy, A., & Duncan, A. 2024, ApJ, 960, 82, doi: 10.3847/1538-4357/ad09afDOI
  53. [55]Mandal, A., Mukherjee, D., & Mignone, A. 2023, ApJS, 268, 40, doi: 10.3847/1538-4365/aced0aDOI
  54. [56]McKinney, J. C., & Gammie, C. F. 2004, ApJ, 611, 977, doi: 10.1086/422244DOI
  55. [57]Metzger, B. D., Hui, L., & Cantiello, M. 2024, The Astrophysical Journal Letters, 971, L34, doi: 10.3847/2041-8213/ad6990DOI
  56. [58]Michael, S., & Durisen, R. H. 2010, MNRAS, 406, 279, doi: 10.1111/j.1365-2966.2010.16694.xDOI
  57. [59]Michel, F. C. 1972, Ap&SS, 15, 153, doi: 10.1007/BF00649949DOI
  58. [60]Nalewajko, K., Kapusta, M., & Janiuk, A. 2024, A&A, 692, A37, doi: 10.1051/0004-6361/202450490DOI
  59. [61]Narayan, R., Igumenshchev, I. V., & Abramowicz, M. A. 2003, PASJ, 55, L69, doi: 10.1093/pasj/55.6.L69DOI
  60. [62]Narayan, R., Sądowski, A., Penna, R. F., & Kulkarni, A. K. 2012, MNRAS, 426, 3241, doi: 10.1111/j.1365-2966.2012.22002.xDOI
  61. [63]Noble, S. C., Gammie, C. F., McKinney, J. C., & Del Zanna, L. 2006, ApJ, 641, 626, doi: 10.1086/500349DOI
  62. [64]Noble, S. C., Krolik, J. H., & Hawley, J. F. 2009, ApJ, 692, 411, doi: 10.1088/0004-637X/692/1/411DOI
  63. [65]Noh, H., Hwang, J.-c., & Bucher, M. 2019, ApJ, 877, 124, doi: 10.3847/1538-4357/ab17deDOI
  64. [66]Oliveira, A. M., Velten, H. E. S., Fabris, J. C., & Salako, I. G. 2014, European Physical Journal C, 74, 3170, doi: 10.1140/epjc/s10052-014-3170-2DOI
  65. [67]Pe’er, A., Bégué, D., & Zhang, G. 2024, in IAU Symposium, Vol. 378, Black Hole Winds at All Scales, ed. G. Bruni, M. Diaz Trigo, S. Laha, & K. Fukumura, 112–116, doi: 10.1017/S1743921323002879
  66. [68]Piro, A. L., & Pfahl, E. 2007, ApJ, 658, 1173, doi: 10.1086/511672DOI
  67. [69]Porth, O., Olivares, H., Mizuno, Y., et al. 2017, Computational Astrophysics and Cosmology, 4, 1, doi: 10.1186/s40668-017-0020-2DOI
  68. [70]Porth, O., Chatterjee, K., Narayan, R., et al. 2019, ApJS, 243, 26, doi: 10.3847/1538-4365/ab29fdDOI
  69. [71]Prather, B., Wong, G., Dhruv, V., et al. 2021, The Journal of Open Source Software, 6, 3336, doi: 10.21105/joss.03336DOI
  70. [72]Prather, B. S. 2024, arXiv e-prints, arXiv:2408.01361, doi: 10.48550/arXiv.2408.01361DOI
  71. [73]Plonka, P., & Janiuk, A. 2026, A&A, 709, A80, doi: 10.1051/0004-6361/202558355DOI
  72. [74]Radice, D., Bernuzzi, S., Perego, A., & Haas, R. 2022, MNRAS, 512, 1499, doi: 10.1093/mnras/stac589DOI
  73. [75]Rafikov, R. R., Cimerman, N. P., Fairbairn, C. W., & Dittmann, A. J. 2026, MNRAS, 548, stag344, doi: 10.1093/mnras/stag344DOI
  74. [76]Rezzolla, L., Zanotti, O., & Pons, J. A. 2003, Journal of Fluid Mechanics, 479, 199, doi: 10.1017/S0022112002003506DOI
  75. [77]Rusanov, V. 1962, USSR Computational Mathematics and Mathematical Physics, 1, 304, doi: 10.1016/0041-5553(62)90062-9DOI
  76. [78]Ryu, T., Krolik, J., Piram, T., & Noble, S. C. 2020, ApJ, 904, 99, doi: 10.3847/1538-4357/abb3cdDOI
  77. [79]Shankar, S., Mösta, P., Brandt, S. R., et al. 2023, Classical and Quantum Gravity, 40, 205009, doi: 10.1088/1361-6382/acf2d9DOI
  78. [80]Shibata, M., & Fujibayashi, S. 2026, ApJ, 996, 57, doi: 10.3847/1538-4357/ae22d4DOI
  79. [81]Shibata, M., Fujibayashi, S., Wanajo, S., et al. 2025, PhRvD, 111, 123017, doi: 10.1103/msy2-fwhxDOI
  80. [82]Shibata, M., Kiuchi, K., Sekiguchi, Y., & Suwa, Y. 2011, Progress of Theoretical Physics, 125, 1255, doi: 10.1143/PTP.125.1255DOI
  81. [83]Siegel, D. M., Mösta, P., Desai, D., & Wu, S. 2018, ApJ, 859, 71, doi: 10.3847/1538-4357/aabcc5DOI
  82. [84]Sądowski, A., Narayan, R., McKinney, J. C., & Tchekhovskoy, A. 2014, MNRAS, 439, 503, doi: 10.1093/mnras/stt2479DOI
  83. [85]Sądowski, A., Narayan, R., Tchekhovskoy, A., & Zhu, Y. 2013, MNRAS, 429, 3533, doi: 10.1093/mnras/sts632DOI
  84. [86]Stone, J. M., Gardiner, T. A., Teuben, P., Hawley, J. F., & Simon, J. B. 2008, ApJS, 178, 137, doi: 10.1086/588755DOI
  85. [87]Stone, J. M., Mullen, P. D., Fielding, D., et al. 2026, ApJS, 283, 27, doi: 10.3847/1538-4365/ae3717DOI
  86. [88]Taylor, P. A., Miller, J. C., & Podsiadlowski, P. 2011, MNRAS, 410, 2385, doi: 10.1111/j.1365-2966.2010.17618.xDOI
  87. [89]Tchekhovskoy, A., Narayan, R., & McKinney, J. C. 2011, MNRAS, 418, L79, doi: 10.1111/j.1745-3933.2011.01147.xDOI
  88. [90]Thompson, K. W. 1986, Journal of Fluid Mechanics, 171, 365–375, doi: 10.1017/S0022112086001489DOI
  89. [91]Toomre, A. 1964, ApJ, 139, 1217, doi: 10.1086/147861DOI
  90. [92]Tóth, G. 2000, Journal of Computational Physics, 161, 605, doi: 10.1006/jcph.2000.6519DOI
  91. [93]Urrutia, G., Janiuk, A., & Olivares, H. 2026, Journal of High Energy Astrophysics, 53, 100602, doi: 10.1016/j.jheap.2026.100602DOI
  92. [94]Wessel, E., Paschalidis, V., Tsokaros, A., Ruiz, M., & Shapiro, S. L. 2023, PhRvD, 107, 123031, doi: 10.1103/PhysRevD.107.123031DOI
  93. [95]White, C. J., Stone, J. M., & Gammie, C. F. 2016, ApJS, 225, 22, doi: 10.3847/0067-0049/225/2/22DOI
  94. [96]Woosley, S. E., & Heger, A. 2006, ApJ, 637, 914, doi: 10.1086/498500DOI
  95. [97]Yuan, C., Cardoso, V., Duque, F., & Younsi, Z. 2025, PhRvD, 111, 063048, doi: 10.1103/PhysRevD.111.063048DOI

Paper details

vlnc:W_yyjwh48x
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 4

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents