Brought to you by:

grmonty: A MONTE CARLO CODE FOR RELATIVISTIC RADIATIVE TRANSPORT

, , , and

Published 2009 September 30 © 2009. The American Astronomical Society. All rights reserved.
, , Citation Joshua C. Dolence et al 2009 ApJS 184 387 DOI 10.1088/0067-0049/184/2/387

0067-0049/184/2/387

ABSTRACT

We describe a Monte Carlo radiative transport code intended for calculating spectra of hot, optically thin plasmas in full general relativity. The version we describe here is designed to model hot accretion flows in the Kerr metric and therefore incorporates synchrotron emission and absorption, and Compton scattering. The code can be readily generalized, however, to account for other radiative processes and an arbitrary spacetime. We describe a suite of test problems, and demonstrate the expected N−1/2 convergence rate, where N is the number of Monte Carlo samples. Finally, we illustrate the capabilities of the code with a model calculation, a spectrum of the slowly accreting black hole Sgr A* based on data provided by a numerical general relativistic MHD model of the accreting plasma.

Export citation and abstract BibTeX RIS

1. INTRODUCTION

There is wide interest in calculating the emergent radiation from relativistic astrophysical sources, including accreting black holes, accreting neutron stars, and relativistic blast waves. A variety of methods for solving the radiative transfer problem in these sources have been developed over the last few decades (e.g., Pozdynakov et al. 1983; Górecki & Wilczewski 1984; Hauschildt & Wehrse 1991; Carrigan & Katz 1992; Coppi et al. 1993; Stern et al. 1995; Poutanen & Svensson 1996; Zane et al. 1996; Dove et al. 1997; Böttcher & Liang 2001; Schnittman et al. 2006; Noble et al. 2007; Wu et al. 2008), some based on Monte Carlo schemes. Few of these schemes take full account of relativistic effects in the source, however, and this is crucial in estimating the spectra of hot plasma deep in a gravitational potential well, or highly relativistic blast waves. Monte Carlo transport of radiation in accretion flows around compact objects has been considered by (e.g., Schnittman & Krolik 2009; Schnittman 2006; Yao et al. 2005; Böttcher et al. 2003; Böttcher & Liang 2001; Laurent & Titarchuk 1999; Agol & Blaes 1996; Stern et al. 1995). Among others, Cullen (2001), Molnar & Birkinshaw (1999), Hua (1997), Górecki & Wilczewski (1984), and Pozdynakov et al. (1983) give more general discussions of Monte Carlo radiative transfer techniques.

We were motivated by efforts to model the radio source and black hole candidate Sgr A*. Our interest in this source drove us to develop a numerical scheme that could accurately calculate spectra of a relativistic source in which the plasma properties (velocity, density, magnetic field strength, and temperature) were specified by a separate model—that is, sources in which radiation plays a negligible role in the dynamics and energetics. The result, a Monte Carlo scheme called grmonty, is described in this paper. The spirit of our calculation is to obtain an accurate spectrum with as few approximations as possible. To this end, we treat Compton scattering with no expansions in v/c, and allow for general angle-dependent emission and absorption (we specialize to thermal synchrotron in this work).

In designing grmonty, our philosophy has been to maximize the physical transparency and minimize the length of the code, occasionally at the cost of reduced performance. Sometimes simplicity and efficiency are in harmony. We chose to directly integrate the geodesic equation rather than using a scheme that relies on integrability of geodesics in the Kerr metric. We will show that for radiative transfer problems where many points are required along each geodesic, direct integration is not only simpler and easier to modify, but also faster.

Our paper is organized as follows. In Section 2, we describe how we sample emission, and in Section 3 we describe how we track photons along geodesics. Evolution of superphoton weights under absorption is described in Section 4, and sampling of scattered photons is discussed in Section 5. Photons at large distance from the source must be sampled and assembled into spectra; this is described in Section 6. The code has been extensively verified; we describe the tests in Section 7. Section 8 describes a sample calculation and Section 9 summarizes our results.

Throughout this paper we assume that there is an underlying model that can be queried to supply the rest-mass density ρ0, the internal energy u, the four-velocity uμ, and magnetic field four-vector bμ for the radiating plasma. Usually we expect the model to be supplied by a numerical simulation in a coordinate basis xμ.

2. MANUFACTURING SUPERPHOTONS

Emission in grmonty is treated by sampling the emitted photon field. The samples, here called "superphotons" (also "photon packets"), have weight w, coordinates xμ, and wave vector kμ. The weight w ≫ 1 is a pure number that represents the ratio of photons to superphotons: dN = wdNs (Ns≡ number of superphotons, N≡ number of photons). In our models the weight is a function of the emitting plasma frame frequency ν and nothing else. The coordinates are typically in model units (e.g., for a black hole accretion flow calculation, length unit L = GM/c2), and the components of kμ are given in units of mec2.

How should superphotons be distributed over xμ and kμ? The initial superphoton momentum can be described in an orthonormal tetrad basis eμ(a) that is attached to the plasma, so that eμ(t) = uμ (μ is the coordinate index, and (a) is the index associated with the tetrad basis, raised and lowered using the Minkowski metric). In the tetrad basis k(a) is specified by frequency ν and spatial direction unit vector $\hat{\bf n}$ that is contained within the solid angle dΩ. The probability distribution for superphotons is then

Equation (1)

where jν is the emissivity (always defined in the plasma frame), since ${\sqrt{-g}}\, d^3x dt$ is invariant (meaning coordinate invariant). In a time interval Δt, we expect to create

Equation (2)

superphotons over the entire model volume. The total computational effort is proportional to Ns,tot, so we control the computational effort by scaling the weights.

How should we distribute superphotons over the volume? grmonty subdivides the model volume into volume elements ("zones") of size Δ3x (e.g., in Boyer-Lindquist t, r, θ, ϕ coordinates for the Kerr metric, ΔrΔθΔϕ). For zone i we expect

Equation (3)

to be created in time Δt. We create Ns,i superphotons at the center of zone i. Fractional Ns,i are dealt with by rejection sampling.

The momentum-space (wave vector) piece of the probability distribution (1) can be sampled by techniques outlined below to give ν and $\hat{\bf n}$. With xμ, ν and $\hat{\bf n}$ in hand, we can construct k(a) and, finally, transform to the coordinate basis eμ(a)k(a) = kμ.

The remaining ingredients in the sampling procedure are the emissivity, the orthonormal tetrads, and the sampling procedures for ν and $\hat{\bf n}$.

2.1. Emissivity

grmonty depends on the emissivity only through functions that specify jν and ∫dνdΩjν/ν, so it is straightforward to include any emission/absorption process.

In our target problem, the only source of superphotons is thermal synchrotron emission at dimensionless temperature ΘekTe/(mec2). P. K. Leung & C. F. Gammie (2009, in preparation) show that, for Θe ≳ 0.5,

Equation (4a)

Equation (4b)

Equation (4c)

where K2 is the modified Bessel function of the second kind, ne is the number density of electrons, B is the magnetic field strength, and θ is the angle between the wave vector and magnetic field. For large Θe, K2−1e) ≃ 2Θ2e, but for Θe ≲ 1 better agreement with the emissivities of P. K. Leung & C. F. Gammie (2009, in preparation) is obtained if K2 is evaluated directly. Since the emissivity must be evaluated many times, it is most efficient to precompute K2−1e) at the beginning of the calculation and store the results in a table.

2.2. Orthonormal Tetrads

The wave vector sampling is done in an orthonormal tetrad attached to the fluid. We construct the orthonormal tetrad eμ(a) using numerical Gram–Schmidt orthogonalization. Here μ is the coordinate index, and (a) is the index associated with the tetrad basis, which is raised and lowered using the Minkowski metric.

We set eμ(0) = uμ (uμ≡ plasma four-velocity), and then use bμ, the magnetic field four-vector, as the first trial vector (this is numerically convenient since we will want to orient wave vectors with respect to the magnetic field; if bμ = 0 then we use a default, radius-aligned, trial vector). Thus eμ(1) = NORM(bμeμ(0)(eν(0)bν)) (NORM: normalize). The process is repeated with additional trial vectors to create a full tetrad basis.

The tetrad-to-coordinate basis transformation is

Equation (5)

and the coordinate to tetrad transformation is

Equation (6)

With these transformations in hand, we can construct the superphoton wave vector in the orthonormal frame and then transform it to the coordinate basis.

2.3. Wave Vector Sampling Procedure

2.3.1. Photon Energy

Within zone i superphotons are distributed over frequency according to the distribution

Equation (7)

We sample the distribution only between a minimum and maximum frequency νmin and νmax. These must be chosen so that no significant emission is omitted from the final spectrum.

We distribute superphotons over frequency by rejection sampling. For simplicity, we use a constant envelope function equal to the maximum of Equation (7) (for zone i). Thus we draw tentative values uniformly in ln ν from νmin to νmax. The efficiency of the sampling procedure is the ratio of the areas under the distribution and envelope, so if the distribution given in Equation (7) is sharply peaked this technique can be inefficient.

In practice, we choose a tentative frequency ν0 = exp(r1ln νmaxmin + ln νmin), where r1 is drawn from a uniform distribution on [0,1) (we use the Mersenne twister random number generator from the GNU Scientific Library, hereafter GSL). A second number r2 is drawn from [0,1) and the process is repeated until

Equation (8)

The efficiency of this process is ∼15%, but the cost is small compared to the total cost of grmonty.

2.3.2. Photon Direction

The superphoton direction $\hat{\bf n}$ is described by polar coordinates θ and ϕ in the tetrad frame, where θ is the angle between the spatial part of the wave vector and the magnetic field. The colatitude θ is obtained by rejection sampling: a tentative value for θ is obtained by drawing μ = cos θ from a uniform distribution on [ − 1, 1), a second number r is drawn from a uniform distribution on [0, 1), and θ is accepted if

Equation (9)

(this procedure is specific to the synchrotron emissivity). The efficiency of this scheme is problem dependent; for our target application the efficiency is ∼65%. Finally, ϕ is drawn from a uniform distribution on [0, 2π).

2.3.3. Transformation to Coordinate Frame

Once θ, ϕ, and epsilon = hν/mec2 are selected, the wave vector is completely specified in the orthonormal tetrad frame:

Equation (10a)

Equation (10b)

Equation (10c)

Equation (10d)

and the wave vector in the coordinate frame is kμ = eμ(a)k(a).

3. GEODESIC INTEGRATION

General relativistic radiative transfer differs from conventional radiative transfer in Minkowski space in that photon trajectories are no longer trivial; photons move along geodesics. Tracking geodesics is a significant computational expense in grmonty.

The governing equations for a photon trajectory are

Equation (11)

which defines λ, the affine parameter, the geodesic equation

Equation (12)

and the definition of the connection coefficients

Equation (13)

in a coordinate basis.

We assume nothing about the metric, so it is easy to change coordinate systems and even to extend the code to dynamical spacetimes. Nevertheless, our main application—to black hole accretion flows—is in the Kerr metric, where geodesics are integrable. The four constants of the motion are the energy-at-infinity E (in Boyer–Lindquist coordinates t, r, θ, ϕ, E = −kt), the angular momentum l = kϕ, Carter's constant $Q = k_\theta ^2 + k_\phi ^2 \cot ^2\theta - a^2 k_t^2 \cos ^2\theta$ (see Carter 1968), and the condition that kα be null: kμkμ = 0, equivalent to the dispersion relation for photons in vacuo: ω2 = c2k2. These four constants of the motion can be used to quasi-analytically obtain xμ and kμ in terms of an initial (or final) position and wave vector (see, e.g., Rauch & Blandford 1994; Beckwith & Done 2005; Dexter & Agol 2009).

The integrability of geodesics in the Kerr metric would appear to provide an opportunity for significant computational economies. We show below, however, that direct integration of Equations (11) and (12) is not only simpler and more flexible but also faster than at least one implementation of an integral-based technique.

Which ODE integration algorithm is best for the geodesic equation? If only a few coordinate evaluations are required over the entire geodesic then a high-order scheme is optimal. For example, we have found that the embedded Runge–Kutta Prince–Dorman method available in GSL is fast and accurate; it can easily be made to conserve the integrals of motion to machine precision. Many coordinate evaluations are required, however, when integrating the equation of radiative transfer, as grmonty does, along superphoton trajectories. A second-order scheme can then provide the required accuracy at minimal cost.

Evaluating the connection coefficients is expensive, so we want to choose a scheme that minimizes the number of evaluations. The velocity Verlet algorithm, which for the geodesic equation is

Equation (14a)

Equation (14b)

Equation (14c)

Equation (14d)

requires only one evaluation of the connection coefficients per step. Accuracy can be improved by using the result of Equation (14d) to recompute the derivative Equation (14c) with kμn+1,p = kμn+1 and then reevaluating Equation (14d). This process is repeated until the change in the wave vector between estimates is below some tolerance. In grmonty , we continue this iteration until the fractional change is less than 10−3 (typically only once or twice). This does not require any additional evaluations of Γαμν. Very rarely we find that this iteration fails to converge, and then grmonty defaults to taking the step with a classical fourth-order Runge–Kutta technique.

How fast and accurate is our geodesic integration scheme? We propose the following benchmark. Consider a point on a direct, circular, marginally stable orbit in the equatorial plane of a black hole with spin a/M = 1 − 2−4 = 0.9375 that emits radiation isotropically in its rest frame. Sample the emitted photons (in a Monte Carlo sense; the analytic circular orbit orthonormal tetrads available in Bardeen et al. 1972 are useful for constructing the initial wave vectors) and track them until they cross the horizon or reach rc2/(GM) = 100 (r is the Boyer–Lindquist or Kerr–Schild radial coordinate). Figure 1 shows as dots a representative sample of photon geodesics from grmonty in the coordinate frame, illustrating the effects of relativistic beaming, lensing, and frame dragging.

Figure 1.

Figure 1. Photon geodesics for isotropic emission from the rest frame of a fluid element in a marginally stable circular orbit around a Kerr black hole with a/M = 0.9375. Results shown from grmonty (points) and geokerr (lines). The point size varies linearly with the z-coordinate.

Standard image High-resolution image

Second-order convergence of the velocity Verlet integration scheme is demonstrated in Figure 2, which plots the average fractional error in E, l, and Q as a function of a step-size parameter ε. We typically set ε = 0.04 as a compromise between performance and accuracy; the average fractional errors at the end of the integrations are ∼2 × 10−3, ∼4 × 10−2, and ∼8 × 10−2 for E, l, and Q, respectively. We have verified that this choice makes geodesic tracking errors subdominant in the error budget for the overall spectrum.

Figure 2.

Figure 2. Average fractional error in the conserved quantities kt and kϕ as a function of step-size parameter ε. The solid line is ε2, showing that grmonty's geodesic integrator converges at second order.

Standard image High-resolution image

With ε = 0.04, grmonty integrates ∼16, 700geodesicss−1 on a single core of an Intel Xeon model E5430. If we use fourth-order Runge–Kutta exclusively so that the error in E, l, and Q is ∼1000 times smaller, then the speed is ∼6200geodesicss−1. If we use the Runge–Kutta Prince–Dorman method in GSL with ε = 0.04 the fraction error is ∼10−10 and the speed is ∼1700geodesicss−1. These results can be compared to the publicly available integral-based geokerr code of Dexter & Agol (2009), whose geodesics are shown as the (more accurate) solid lines in Figure 1. If we use geokerr to sample each geodesic the same number of times as grmonty (∼180), then on the same machine geokerr runs at ∼1000geodesicss−1. It is possible that other implementations of an integral-of-motion-based geodesic tracker could be faster.

If only the initial and final states of the photon are required, we find that geokerr computes ∼77, 000geodesicss−1. The adaptive Runge–Kutta Cash–Karp integrator in GSL computes ∼34, 500geodesicss−1 with fractional error ∼10−3.

4. ABSORPTION

grmonty treats absorption deterministically. We begin with the radiative transfer equation written in the covariant form

Equation (15)

(see Mihalas & Mihalas 1984). Here Iν is specific intensity and αν,a is the absorption coefficient (which is always evaluated in the fluid frame). The absorption coefficient must be computed by a separate subroutine; for thermal synchrotron emission we set αν,a = jν/Bν. ${\mathcal C}$ is a constant that depends on the units of kμ (in grmonty, electron rest mass), ν (Hz), and the length unit L for the simulation in cgs units. For grmonty,

Equation (16)

Each quantity in parentheses in Equation (15) is invariant; Iν3, for example, is proportional to the photon phase space density.

Since Iν3 is proportional to the number of photons moving along each ray, Iν3w, and Equation (15) implies (ignoring emission)

Equation (17)

where

Equation (18)

is the differential optical depth to absorption and the quantity in parentheses is the "invariant opacity." This equation we integrate with second-order accuracy

Equation (19)

and then set

Equation (20)

Since the components of kμ are expressed in units of the electron rest-mass energy, ν = −kμuμmec2/h. Storing the invariant opacity at the end of each step saves computations since it can be reused as the beginning of the following step.

5. SCATTERING

Our treatment of scattering consists of two parts: the first determines where a superphoton should scatter and the second determines the energy and direction of the scattered superphoton.

5.1. Selection of Scattering Optical Depth

When a superphoton is created or scattered, grmonty selects the scattering optical depth τs at which the next scattering event will take place. Scattering follows the cumulative probability distribution

Equation (21)

so superphotons will experience on average τs scattering events when τs ≲ 1. In optically thin sources this would result in poor signal to noise in portions of the spectrum dominated by scattered light. To overcome this, we use the biased probability distribution

Equation (22)

where b is a bias parameter. This technique was originally proposed by Kahn (1950) in the context of deep penetration of neutrons in radiation shielding and has since been extensively explored in the nuclear engineering literature (often referred to as exponential biasing or exponential transform). Whereas in deep penetration problems b ⩽ 1 in order to allow for sampling of radiation at high optical depths, here we set b ⩾ 1 in order to better sample scattered photons at low optical depths. Superphotons now experience on average bτs scattering events. Two superphotons emerge from a scattering event: the incident superphoton of weight w and a new scattered superphoton. For conservative scattering the incident superphoton has its weight reset to w(1 − 1/b) and the new superphoton has weight w/b, so that weight (photon number) is conserved.

What should we choose for the bias parameter b? The goal is to set b such that scattering is more likely to occur in regions which contribute most to the spectrum. This is an example of the more general technique of importance sampling. Typically we set the bias parameter b = MAX(1, αΘ2es,max) (α is a scaling factor we set to 1/〈Θe2 where 〈Θe〉 is the volume averaged dimensionless temperature and τs,max is an estimated maximum scattering optical depth) to improve sampling on the high-energy side of each scattering order, which is populated by photons scattered from a high-temperature plasma. If the bias factor is too large a "chain reaction" results in an exponentially growing number of superphotons; 1/τs,max is an estimate of the critical bias factor in a Θe = 1 plasma.

We evaluate the scattering optical depth along geodesics in a manner analogous to the absorption optical depth;

Equation (23)

is the scattering depth along a step.

5.1.1. Covariant Evaluation of Extinction Coefficient

In our applications electron scattering dominates. The general, invariant expression for the rate of binary interactions dNab between a population of particles dNa and dNb is

Equation (24)

where δab prevents double counting if a = b, d3p = dp1dp2dp3, σ is the invariant cross section, and vab = c(1 + m2am2b/(−paμpμb)2)1/2. This is the manifestly covariant generalization of Equation (12.7) of Landau & Lifshitz (1975).

We want to use this expression to find the cross section for a photon with wave vector kμ0 interacting with a population of particles of mass m>0. We therefore set dNγ/d3xd3p = δ(kμkμ0) and, dropping the subscripts on k and p, the integral reduces to

Equation (25)

where dnm = dNm/d3x. In Minkowski coordinates (${\sqrt{-g}}= 1$), define βm≡ the particle speed in the plasma frame and μm≡ the cosine of the angle between the particle momentum and photon momentum in the plasma frame. Then

Equation (26)

It is convenient to rewrite this rate in terms of a "hot cross section"

Equation (27)

so that the interaction rate for a single photon is nmσhc and the extinction coefficient is

Equation (28)

So far we have assumed nothing about the interaction process.

5.1.2. Electron Scattering

For electron scattering the cross section is the Klein–Nishina total cross section expressed in terms of the photon energy in the electron rest frame ≡epsilone = epsilonγe(1 − μeβe), (γe ≡ (1 − β2e)−1/2 and we have substituted the subscript e for m):

Equation (29)

Here σT is the Thomson cross section. For epsilon ≪ 1,

Equation (30)

which is numerically stable for small epsilon, unlike Equation (29).

Typically we assume a thermal electron distribution,

Equation (31)

and evaluate (27) by direct integration to obtain σhe, epsilon). It is efficient to store the resulting cross sections in a two-dimensional lookup table at the beginning of the calculation. Our σh agrees with Wienke (1985).

5.2. Scattering Kernel

Once it is determined that a superphoton should be scattered at an event xμs, the superphoton is passed to a scattering kernel which processes the scattering event according to the following procedure. Only unpolarized light is considered.

First, a plasma frame orthonormal tetrad is constructed by the same Gram–Schmidt orthogonalization procedure described in Section 2, and the old superphoton wave vector is transformed from the coordinate frame to the tetrad frame.

Second, a scattering electron is selected. We use the procedure described by Canfield et al. (1987), which selects the four-momentum pμe of the scattering electron with an efficiency of 72% at Θe = 1 and nearly 100% for Θe ≪ 1 or Θe ≫ 1 (Canfield et al. 1987).

Third, we boost from the plasma frame tetrad to an electron frame tetrad qμ(a) and construct the scattered photon wave vector in this frame. The differential scattering cross section is sampled for the scattered photon energy epsilon'e and the scattering angle θ. For low_energy photons (epsilone < epsilonl; in grmonty  epsilonl = 10−4) the scattering is approximately elastic, so we set epsilon'e = epsilone and sample the Thomson differential cross section

Equation (32)

for the scattering angle θ using a rejection scheme. For epsilone>epsilonl we sample the Klein–Nishina differential cross section

Equation (33)

for epsilon'e using a rejection scheme. Here cos θ = 1 + 1/epsilone − 1/epsilon'e. This procedure is inefficient for epsilone ≫ 1, but in our target application such large photon energies are rare. Drawing a final angle ϕ from a uniform distribution on [0, 2π) completes the specification of the photon wave vector

Equation (34a)

Equation (34b)

Equation (34c)

Equation (34d)

in the electron-frame tetrad basis qμ(a); q(1) is aligned parallel to the spatial part of the incoming photon wave vector.

Finally, we boost back from the electron-frame tetrad to the plasma frame tetrad (some of these steps are combined in our code for computational efficiency), and use the plasma frame basis vectors to obtain the coordinate frame scattered photon wave vector k'μ.

6. SPECTRA

Spectra can be measured using a "detector" with area ΔA at distance R, frequency channels of logarithmic width Δln ν, and integration times ΔT. The flux density in frequency bin i is then just

Equation (35)

where the sum is taken over all superphotons j that land in the channel during the integration. In principle, a software detector can behave just like a physical detector, producing time-dependent spectra from time-dependent flow models. In practice, time-dependent models are not (yet) treated self-consistently.

To see why, consider a time-dependent model based on a general relativistic magnetohydrodynamics (GRMHD) model of a black hole accretion flow. Self-consistent treatment of the radiation field would require generating and tracking superphotons through the simulation data as it evolves, i.e., coupling the grmonty to the GRMHD code (the simulation data could be stored and post-processed, but this would require storing almost every time step and would be impractical and inefficient). The mean number of superphotons tracked simultaneously would depend on the desired signal to noise in the final spectrum, as well as the time and energy resolution. Our experience suggests that for nominal energy resolution, signal to noise, and time resolution of order the horizon light crossing time, ∼108 superphotons would need to be maintained within the simulation for the duration of the evolution. The total number required is then Ntot ≫ 108 and is currently inaccessible without significant computational resources. We plan to attempt this calculation later.

For now we construct spectra of time-dependent data using a stationary-data (or "fast-light") approximation: each time slice of data is treated as if it were stationary (time-independent). The slice emits superphotons for a time Δt. The photons then propagate through the slice data (as t varies along a geodesic the fluid variables are held fixed) and are detected at large distance. The time-steady flux is obtained by substituting Δt for ΔT in Equation (35).

6.1. Measuring νLν

In practice, we measured νLν,i rather than Fν,i. Since νLν = 4πR2νFν, and R2A is the solid angle ΔΩ occupied by the detector,

Equation (36)

Typically our "detectors" capture all the superphotons in a large angular bin ΔΩ around the source. For example, in studies of axisymmetric black hole accretion flows the angular bins capture all photons with Boyer–Lindquist r>100GM/c2, θn < θ < θn+1, independent of ϕ, where θn are the bin boundaries.

We can also estimate average values for any quantity Q associated with emission from a source (e.g., the absorption optical depth). We define the weight-averaged value of Q via

Equation (37)

where the sum is taken within an energy and angular bin.

6.2. Optimal Weights

The fractional variance in the Monte Carlo estimate for νLν is proportional to $\overline{w^2}/(\overline{N_s} \overline{w}^2)$, where overline means expectation value and Ns is the number of superphotons in the bin. Evidently the optimal weighting of superphotons is achieved when (1) the weights of superphotons are the same within bins and (2) the superphotons are evenly distributed across frequency bins.

If, as we created new superphotons, we knew νLν, then we could set

Equation (38)

and set $\overline{N_s} = N_{s,{\rm tot}}/N_b$, where Nb is the number of frequency bins.

Of course we do not know Lν, but for the special case of an optically thin emitting plasma we can estimate it as

Equation (39)

This estimate assumes that all photons escape to infinity, and it ignores Doppler shift, gravitational redshift, scattering, and angular structure in νLν. Nevertheless, it is useful because (1) it can be calculated before the Monte Carlo calculation begins, and (2) it is far better to use the information contained in this rough estimate of the spectrum than to proceed using, e.g., uniform weights.

7. TESTS

We verify the accuracy of grmonty by comparing spectra produced on idealized problems against a reference spectrum (νLν)ref computed analytically (when possible) or computed by an independent code. For all tests we use the following error norm, which effectively measures the maximum of the fractional error, compared to the reference solution, over frequency:

Equation (40)

where Δln ν = ln(νmaxmin) is the range of integration. The range of integration is the same as plotted in the spectra for each test.

7.1. Optically Thin Synchrotron Sphere

First we consider emission from a homogeneous, optically thin spherical cloud of unit volume threaded by a vertical magnetic field in flat space. The cloud parameters are Θe = 100, B = 1G, and ne = 1015cm−3, which gives an optical depth at ν = 109Hz of ∼10−2 perpendicular to the magnetic field. The emissivity and absorptivity are constant along any line of sight, so

Equation (41)

where L is the path length through the sphere. We numerically integrate this expression over detector solid angle to compute the spectral energy distribution, and compare with the spectrum grmonty produces in Figure 3. Evidently the result is unbiased. Figure 4 demonstrates that grmonty converges on the correct solution as ∝N−1/2.

Figure 3.

Figure 3. In the top panel, the spectrum of a synchrotron-emitting sphere with low optical depth above ∼108Hz viewed nearly perpendicular to the magnetic field from grmonty (crosses) and from a semi-analytic procedure (solid line). The bottom panel shows the fractional difference between the two results.

Standard image High-resolution image
Figure 4.

Figure 4. Integrated fractional error in the grmonty spectrum for a synchrotron-emitting sphere with low optical depth viewed nearly perpendicular to the magnetic field as a function of the number of superphotons produced. The results are similar for other magnetic field orientations. The dashed line is proportional to N−1/2.

Standard image High-resolution image

7.2. Optically Thick Synchrotron Sphere

The second test is identical except that the electron number density and therefore the optical depth are increased by a factor of 105. The intensity along any line of sight is again

Equation (42)

The emitting region becomes optically thick when (jν/Bν)L ≳ 1. For the thermal synchrotron emissivity we use, this occurs below a critical frequency.

The spectrum is shown in Figure 5 and the convergence is shown in Figure 6. The figures make two key points: convergence is slow for small numbers of superphotons; and the overall magnitude of the error is larger than in the optically thin case shown in Figure 4.

Figure 5.

Figure 5. In the top panel, the spectrum of a synchrotron-emitting sphere of high optical depth below ∼1011Hz viewed nearly perpendicular to the magnetic field from grmonty (crosses) and for a semi-analytic procedure (solid line). The bottom panel shows the fractional difference between the two results.

Standard image High-resolution image
Figure 6.

Figure 6. Integrated fractional error in the grmonty spectrum of a synchrotron-emitting sphere with high optical depth as a function of the number of superphotons produced. The dashed line is proportional to N−1/2.

Standard image High-resolution image

The slow initial convergence is due to the large optical depth at some frequencies. When the optical depth is large no superphotons of appreciable weight are recorded until some superphotons have been created in the fraction ∼1/τ of the volume that lies within the photosphere. Our problem has τ ∼ 105 at ν ∼ 108Hz. Since 〈epsilon〉 effectively measures the maximum of the error over frequency, it is not surprising that grmonty requires ∼106 superphotons before it begins to converge as N−1/2.

7.3. Comptonization of Soft Photons in a Spherical Cloud of Plasma

This test is based on a problem posed in Section 6 of Pozdynakov et al. (1983): the spectrum of a spherical, homogeneous, unmagnetized cloud of radius R that contains thermal electrons at density ne and temperature Te that scatter light from a central, thermal source of temperature Ts. Absorption and emission in the cloud are neglected. The dimensionless parameters of the problem are Θe = kTe/(mec2), τ = RσTne, and Θs = kTs/(mec2).

For this test our reference spectrum is computed with an implementation of Pozdnyakov et al.'s Monte Carlo scheme kindly provided by S. Davis. This code, sphere, has been modified in two ways: we have replaced the approximate hot cross sections defined in Pozdynakov et al. (1983) with our more exact, numerically integrated values, and we use the exact Klein–Nishina cross section Equation (29) when choosing the electron with which a photon should scatter. Without these changes to sphere differences between the spectra are ≲1%, consistent with the error Pozdynakov et al. (1983) quote for their approximations. These small differences are enough, however, to prevent grmonty from converging as expected for large numbers of superphotons.

Figures 79 show the radiation spectra (upper panels) produced by both codes and a fractional difference (bottom panels) between them for Θe = 4, Θs = 10−8 and for various values of the optical depth τ = 10−4, 0.1, and 3. Figure 10 demonstrates that grmonty converges to the reference solution as ∝N−1/2 for each optical depth.

Figure 7.

Figure 7. Spectra (upper panel) from grmonty (points) and sphere (solid line) produced by Comptonization of soft photons in a homogeneous, spherical cloud of hot plasma. Computations are done for: plasma optical thickness τ = 10−4, plasma temperature Θe = 4, and the central source radiative temperature kTr/mec = 10−8. Lower panel shows the fractional difference between the two spectra.

Standard image High-resolution image
Figure 8.

Figure 8. Same as in Figure 7, but for τ = 0.1.

Standard image High-resolution image
Figure 9.

Figure 9. Same as in Figure 7, but for τ = 3.0.

Standard image High-resolution image
Figure 10.

Figure 10. Integrated fractional difference between grmonty and sphere for the spherical scattering test for optical depths of 10−4 (solid), 0.1 (short dash), and 3 (long dash). The dotted line shows the self-convergence results for the sphere code for an optical depth τ = 10−4. The dot-dashed line is proportional to N−1/2.

Standard image High-resolution image

7.4. Synchrotron Self-absorbed Spectra in Black Hole Spacetimes

We consider two idealized problems: (1) smooth, spherically symmetric infall onto a Schwarzschild black hole; (2) a snapshot of a turbulent accretion flow around a Kerr black hole with a/M = 0.9375 produced by general relativistic MHD simulation with the HARM code (Gammie et al. 2003). In this test, our reference solution is computed by the ray tracing code ibothros (Noble et al. 2007). ibothros solves the invariant form of the radiative transfer equation along geodesics that terminate in a fictitious camera at large distance. Spectra are constructed by imaging the source at successive frequencies and performing an angular integral over the images to estimate νLν. In these tests, scattering is turned off in grmonty.

There are algorithmic differences between grmonty and ibothros that lead to differences in their spectra.

First, grmonty measures the flux in energy and angular bins, whereas ibothros measures the flux at a particular inclination and energy. This is not an important effect unless there is sharp angular or energy structure in the spectrum.

The next difference is more subtle and is related to the treatment of gridded model data used to construct these tests. In grmonty,  quantities such as the density, temperature, etc., are viewed as the average of these variables over a grid zone. In ibothros,  the grid variables are viewed as zone-centered samples and a continuous distribution is created by multi-linear interpolation between zone centers. The difference is illustrated in one dimension in Figure 11. ibothros and grmonty therefore differ in zone-averaged emissivity by Ox/L)2, where Δx is the zone size and L is the characteristic scale of the emitting structure.

Figure 11.

Figure 11. Illustration of how interpolation can lead to a discrepancy between grmonty and ibothros when the spectrum is sensitive to grid-scale structure. Shown are the grid specified values for some fluid property (solid line), the interpolated values (dashed line), and the average zone values based on interpolation (dotted line).

Standard image High-resolution image

Differences in the grmonty and ibothros spectra of structures with ΔxL are therefore small. High-frequency synchrotron emission, however, is exponentially dominated by emission from a few zones with highest νs (see Equation (4b); these are the zones with highest temperature or strongest magnetic field). Then Δx/L ∼ 1 for high-frequency emission, and the grmonty and ibothros spectra differ by of order unity. A similar effect occurs for low-frequency synchrotron emission where the optical depth is large. The spectrum is sensitive to the run of physical variables through the photosphere, which has size comparable to or smaller than a grid zone. The subsequent test results will omit these parts of the spectra. These inconsistencies between grmonty and ibothros could be eliminated by using identical, continuous models for subgrid reconstruction. But this would require significant investment in recoding that, in our view, is not worthwhile: to the extent that the spectrum depends on the flow structure at and below the grid scale, it is not reliable.

In spite of these differences, and other differences between the codes related to differing accuracy parameters, grmonty should converge on the ibothros result until the effects of data interpolation become the dominant sources of error.

Figures 12 and 13 show the spectrum and convergence relative to ibothros, respectively, for the spherical accretion problem. This problem is an attractive test for at least two reasons. First, the emission is isotropic so the effects of angular binning in grmonty are eliminated. Second, the flow is smooth, so the differences due to data interpolation will be small. Evidently the spherical accretion model converges at the expected, N−1/2, rate.

Figure 12.

Figure 12. Top panel shows the spectrum of a radially infalling spherically symmetric source threaded with a radial magnetic field around a Schwarzschild black hole as computed by ibothros (solid line) and grmonty (crosses). Bottom panel shows the fractional difference between the two.

Standard image High-resolution image
Figure 13.

Figure 13. Integrated fractional error in the grmonty spectrum for the spherically symmetric Schwarzschild problem as a function of the number of superphotons produced. The dashed line is proportional to N−1/2.

Standard image High-resolution image

Figures 14 and 15 show the spectrum and convergence relative to ibothros, respectively, for the turbulent accretion problem. This comparison is more challenging because the high-energy emission originates in compact "hot spots." Evidently the two models agree at the 10% level everywhere, with the largest differences at high and low frequencies, where the subgrid reconstruction comes into play. Excluding these high- and low-frequency regions, the agreement between the codes is at the few percent level.

Figure 14.

Figure 14. Top panel shows the spectrum of a snapshot from a HARM simulation of a turbulent accretion flow onto a Kerr black hole as computed by ibothros (solid line) and grmonty (crosses). Bottom panel shows the fractional difference between the two.

Standard image High-resolution image
Figure 15.

Figure 15. Integrated fractional error in the grmonty spectrum for the turbulent accretion problem as a function of the number of superphotons produced. The dashed line is proportional to N−1/2.

Standard image High-resolution image

8. SAMPLE CALCULATION AND FULL CODE TESTS

We now apply grmonty to the same HARM simulation data used in the grmonty-ibothros comparison above, this time with scattering enabled. Figure 16 shows the resulting spectrum with the ibothros result shown for comparison. Evidently, scattering has little effect on the sub-mm spectrum since the scattering optical depth is small (∼10−4) but the model now predicts a significant X-ray flux. A more detailed analysis of Comptonized spectra from GRMHD simulations in the context of Sgr A* will be given in a separate paper (M. Mościbrodzka et al. 2009, in preparation).

Figure 16.

Figure 16. Same as Figure 14 except Compton scattering is included. The histograms show the grmonty result for nearly edge-on and face-on inclinations and the solid line is the ibothros spectrum for a nearly edge-on inclination.

Standard image High-resolution image

Figure 17 shows the results of self-convergence tests for the full code. Convergence is initially slow but quickly approaches a rate proportional to N−1/2 as spectral bins become sufficiently sampled. The spectra shown in Figure 16, which were taken from a single run with 109 superphotons, were used for references.

Figure 17.

Figure 17. Self-convergence test results for the spectra shown in Figure 16. Convergence for the edge-on (solid) and face-on (dot-dash) spectra are shown. The dashed line is proportional to N−1/2.

Standard image High-resolution image

9. SUMMARY

We have described and tested a code that solves the radiative transfer problem for optically thin ionized plasmas in general spacetimes. The code treats the full angular dependence of emission and absorption, treats single Compton scattering exactly (double Compton and induced Compton scattering are neglected), and can be easily adapted to simulate emission from both analytic and numerical models. While we have specialized to synchrotron emission in this work, grmonty is constructed so that it is straightforward to include other relevant emission mechanisms such as bremsstrahlung with only minimal modification.

As a demonstration of a practical use for grmonty, we have computed the first spectra, including synchrotron emission and Compton scattering, from GRMHD models of a turbulent accretion disk. Other potential applications of our code are to neutron star accretion, emission from relativistic blast waves, and any problem where relativistic bulk motion makes radiation transfer treatments that expand the flow in orders of v/c problematic.

This work was supported by the National Science Foundation under grants AST 00-93091, PHY 02-05155, and AST 07-09246, and by a Richard and Margaret Romano Professorial scholarship, a Sony faculty fellowship, and a University Scholar appointment to C.F.G. Portions of this work were performed while C.F.G. was a Member at the Institute for Advanced Study in academic year 2006–2007. The authors are especially grateful to Shane Davis and Stu Shapiro for their insights, and to Peter Goldreich, Fred Lamb, and John Hawley for discussions. We thank the anonymous referee for suggestions which helped improve this manuscript in clarity and completeness.

Please wait… references are loading.
10.1088/0067-0049/184/2/387