Paradigmatic examples for testing models of optical light polarization by spheroidal dust

We present a general framework on how the polarization of radiation due to scattering, dichroic extinction, and birefringence of aligned spheroidal dust grains can be implemented and tested in 3D Monte Carlo radiative transfer (MCRT) codes. We derive a methodology for solving the radiative transfer equation governing the changes of the Stokes parameters in dust-enshrouded objects. We utilize the M\"uller matrix, and the extinction, scattering, linear, and circular polarization cross sections of spheroidal grains as well as electrons. An established MCRT code is used and its capabilities are extended to include the Stokes formalism. We compute changes in the polarization state of the light by scattering, dichroic extinction, and birefringence on spheroidal grains. The dependency of the optical depth and the albedo on the polarization is treated. The implementation of scattering by spheroidal grains both for random walk steps as well as for directed scattering (peel-off) are described. The observable polarization of radiation of the objects is determined through an angle binning method for photon packages leaving the model space as well as through an inverse ray-tracing routine for the generation of images. We present paradigmatic examples for which we derive analytical solutions of the optical light polarization by spheroidal dust particles. These tests are suited for benchmark verification of MCpol and other such codes, and allow to quantify the numerical precision reached. We demonstrate that MCpol is in excellent agreement to within 0.1% of the Stokes parameters when compared to the analytical solutions.


Introduction
Dust processes the radiation that astronomical objects emit.Especially ultraviolet to optical light is easily scattered or absorbed.The dust also emits radiation, mostly at infrared to sub-millimetre wavelengths.Nearly all astronomical objects are seen through dust shrouds and their spectral energy distributions (SED) are altered by this.Dust also polarizes the radiation that is scattered, extinct or emitted by grains while passing through the medium.Observations have shown the polarization of radiation due to dust, for example around active galactic nuclei (Miller & Goodrich 1990), around supernovae (Tran et al. 1997), around single stars (Forrest et al. 1975), in the galactic interstellar medium (Serkowski et al. 1975), or other galaxies (Montgomery & Clemens 2014).
Dust clouds have complex morphologies and varying density profiles, and they contain non-spherical dust grains of various sizes and compositions, which are partially aligned.An analytic description of the signatures of dust on the radiation field is only possible under the assumption of strong simplifications, which generally do not hold.A common numerical technique to account for all these different dependencies of the dust-photon interactions is the Monte Carlo radiative transfer (MCRT) approach.In this procedure, photon packages propagate probabilistic through a simulation of the volume under study.Effects like absorption, scattering, and emission of photons are explicitly carried out and the effects on the dust temperature are recorded.A vast body of theoretical work has been developed for MCRT, contact: Ralf.Siebenmorgen@eso.org a starting point can be the review by Steinacker et al. (2013).A large number of radiative transfer codes based on the Monte Carlo technique are available, and their scopes, sophistication, and application domains are extremely different.
The polarization of radiation influences how it interacts with the dust and the interaction with the dust influences the polarization.Several MCRT codes, therefore, started treating polarization in simplified schemes.A first step is often taken by calculating the polarization which is due to scattering at spherical dust grains and electrons.MCRT codes that include such polarization mechanisms have been presented by Voshchinnikov & Karjukin (1994), Bianchi et al. (1996), Harries (2000, TORUS), Watson & Henney (2001, Pinball), Pinte et al. (2006, MCFOST), Min et al. (2009, MCMAX), Robitaille (2011, HYPERION), Goosmann et al. (2014, STOKES), and Kataoka et al. (2015, RADMC-3D), to name a few.We have also treated polarization due to scattering on dust as presented in Peest et al. (2017), hereafter called P17.
Very few MCRT codes implement additional and more sophisticated processes that can lead to the polarization of radiation by dust.Among them are codes developed by Whitney & Wolff (2002) and Lucas (2003), which treat scattering, dichroic extinction and birefringence due to perfectly aligned spheroidal grains.The POLARIS code (Reissl et al. 2016) calculates the polarized emission, scattering, dichroic extinction and birefringence due to (imperfectly) aligned oblate grains.The MCRT code by Bertrang & Wolf (2017) uses in the first step spherical grains for the dust heating and scattering processes and then it uses non-spherical grains aligned by radiative torques and magnetic fields for the dust emission phase.MoCafe (Lee et al. 2008;Seon 2018) uses spherical grains including polarization by scattering and an empirical formula to emulate dichroism based on optical depth and magnetic field alignment.Vandenbroucke et al. (2021) implemented polarized emission by partially aligned spheroidal grains in the SKIRT MCRT code (Camps & Baes 2020).
A code that implements or improves an established functionality can be verified by comparing its results with previous numerical computations.Such benchmark tests are available for dust radiative transfer (RT) models of unpolarized light by Ivezic et al. (1997), Pascucci et al. (2004), Pinte et al. (2009), and Gordon et al. (2017).They provide numerical proof for the scattering, extinction, and emission of radiation due to dust in various environments.For treatments of dust polarization, such tests are generally not accessible except one, which covers the case of scattering by spherical dust grains (Pinte et al. 2009).It compares polarization images of a flared dust disk around a central star.The dust is spherical and extends optically thin above and below the optically thick disk.The geometry of the test provides mostly the accuracy of the polarization after single scattering events.As discussed in P17 when various of the above MCRT codes are applied to more general cases they show significant differences without the correct results being known a priori.Flexible and easily reproducible tests are necessary to benchmark and verify the current and future implementations of polarization due to non-spherical dust.
In this paper, we present a simple and efficient implementation of the polarization of radiation due to scattering, dichroic and birefringent extinction by spheroidal particles.We provide analytical test cases against which we verify our implementation and estimate the numerical accuracy of our code, which we call hereafter MCpol.The goal of this paper is to provide test cases to other teams enabling them to verify and estimate the numerical precision of their codes.This should allow groups from many different research areas to explore polarization including estimated numerical uncertainty.
In Sec. 2 we present the basic equations governing dichroic extinction and scattering of radiation by spheroidal dust grains.We illustrate the functionality of MCpol, and detail how we implement these polarization mechanisms (Sec.3).We describe the validation methods in Sec. 4, which are applied to confirm that the implementations work as desired.We discuss our results and present our conclusions in Sec. 6.

Stokes vector and M üller matrices
The RT equation describes the interaction of radiation with matter.For a medium that absorbs, scatters, and emits radiation, the basic RT equation reads with I the specific intensity of the radiation field1 , n the matter density, j the anisotropic emissivity of radiation, C ext the extinction cross section, C sca the scattering cross section, and Φ the phase function.The different quantities are depending on the position in the medium r, and the direction of the radiation k.This description is incomplete, as it does not consider the polarization of the radiation.We use the Stokes formalism instead, in which the radiation field is the 4D Stokes vector S, (2) The first element describes the intensity of the radiation, the second and third the linear polarization and the fourth the circular polarization (Stokes 1852).There are different conventions in the literature concerning the handedness (Hamaker & Bregman 1996;Peest et al. 2017) Linear polarization refers to a particular direction, which can be any direction perpendicular to the propagation direction.In analogy to observations, we call our choice of the reference direction North, d N , which shall not be confused with magnetic North.In our definition, North is "up" when looking against the propagation direction towards the source.In the plane of the sky East is counted "left" from the North as is common in astronomy.The Stokes vector changes depending on the choice of North.When rotating the North direction by an angle β, the Stokes vector must be multiplied with a rotation matrix R(β) The ideal choice of reference direction depends on the phenomenon.

Scattering by spheroidal grains
For radiation that is scattered on spherical grains, the North is usually chosen in the plane of scattering, defined by the propagation direction before scattering k and the propagation direction of the photons after scattering k (see e.g., Chandrasekhar 1960).This allows for more efficient approaches when treating scattering events as the 16 entries of the scattering matrix (see below) can be simplified in the case of spherical grains to just four independent elements.The method is widely applied (e.g., Goosmann & Gaskell 2007).
For spheroidal grains, the Müller matrices typically have their simplest form when the North is in the plane of incidence (Mishchenko et al. 2002), defined by the propagation direction before scattering and the grain symmetry axis (Fig. 3).
Scattering events by spheroidal grains are described by the 4×4 Müller matrix denoted as Z and called the scattering matrix.For each incoming photon k, Z(k, k ) provides the probability that it is scattered towards an outgoing direction k .The matrix elements depend on the grain shape, size, porosity, and optical constants, as well as the wavelength, and direction of incoming and outgoing radiation.The calculation of Z can be simplified using symmetry arguments.in the case of spheroidal grains in Z only seven of the 16 elements are independent (Bohren & Huffman 1998;Abhyankar & Fymat 1969).For spheroids, the separation of variables method has been established (Asano & Yamamoto 1975;Voshchinnikov & Farafonov 1993).For rotationally symmetric particles, the scattering matrix can be calculated using the so-called T-matrix method (Mishchenko et al. 1996;Mishchenko 1991;Vandenbroucke et al. 2020).For general non-spherical particles, Z can be calculated by binning the grains into a grid of dipoles (Purcell & Pennypacker 1973;Draine 1988;Draine & Flatau 1994).Several codes are publicly available or can be requested from the above-listed authors.The different methods provide consistent results in computing the cross sections up to size parameter x = 2πa/λ ∼ 10 and encounter numerical problems at x > ∼ 20 (Siebenmorgen & Peest 2019;Draine & Hensley 2021).
Because of the rotational symmetry of spheroids, the direction of the incoming radiation can be described by one angle, the angle of incidence.It is defined as the angle between the direction of propagation and the grain symmetry axis.
The scattering part of the RT equation (Eq. 1) changes to a tensor equation when polarization is considered Following Whitney & Wolff (2002) and Mishchenko et al. (2002) we can calculate the total scattering cross-section Csca .It is defined as the integral over all the scattered intensity I relative to the intensity I incident onto a spheroidal grain, The integrals over Z 13 and Z 14 are zero, because the grains are rotationally symmetric and we integrate over the entire unit sphere (Van De Hulst 1957, p. 47-51).The "classical" scattering cross section for unpolarized radiation is C sca , while C sca,pol is the polarization scattering cross-section, which complicates matters and becomes important for polarized impinging light.Hence, the probability that a photon is scattered by a spheroid depends on the polarization status of the photon.

Extinction by spheroidal grains
Extinction by spherical grains is very straightforward and fully described by a single quantity, the extinction cross-section C ext .
For spheroidal grains, things are complicated, as the crosssection also depends on the polarization status of the radiation.The relevant effects are called dichroism and birefringence.Dichroism means that the extinction differs for differently polarized radiation.Birefringence means that the travel speed of the photons through the medium depends on their polarization status.
The extinction term in the RT equation can be expanded to contain the dichroism and birefringence effects, with K the extinction matrix.For spheroids with North in the plane of incidence, the extinction matrix has a block diagonal shape (Martin 1974;Mishchenko 1991;Whitney & Wolff 2002;Lucas 2003;Krügel 2008;Voshchinnikov 2012), The "classical" extinction cross section is C ext .The dichroism cross section C pol describes how much more a radiation wave is polarized parallel to the North direction is extincted than a radiation wave polarized parallel to the East direction.The birefringence cross-section C cpol represents how much more a North polarized wave is slowed down than an East polarized wave.All cross sections depend on the grain shape, size, porosity, and optical constants, the wavelength, and the angle of incidence.

RT equation
When polarization due to spheroids is considered, the basic RT equation (1) becomes the following partial integrodifferential vector equation The goal of polarized radiative transfer is to derive the Stokes vector S at any position r and in any direction k for a given density n, emissivity j and optical properties and alignment of the dust grains.

MCpol
We implement polarization in the MCRT code developed by Krügel (2008).The efficiency of the code was significantly improved by Heymann & Siebenmorgen (2012) who vectorized it using graphical processing units (GPUs) and applied for optically thin cells the treatment by Lucy (1999) and for optically thick cells the method by Fleck & Canfield (1984).A ray-tracing routine allows the computation of images of areas of interest at any wavelength.It uses the scattering and absorption events treated in the simulation and enable the calculation of SEDs of subdomains of the model.The code has been applied to describe the effective extinction curve when photons are scattering in and out of the observing beam (Krügel 2009).It has been used to investigate the structure of disks around T Tauri and Herbig Ae stars (Siebenmorgen & Heymann 2012), to create a two-phase AGN SED library (Siebenmorgen & Heymann 2012), to study the effects of a clumpy ISM on the extinction curve (Scicluna & Siebenmorgen 2015), and to examine the the appearance of dusty filaments at different viewing angles (Chira et al. 2016).A time-dependent MCRT version was used to discuss the impact of a circumstellar dust halo on the photometry of supernovae Ia (Krügel 2015).So far polarization has not been considered in MCpol.We present a MCRT dust polarization implementation for spheroidal grains that keeps the code backwards compatible.This means that the logical order of the processing steps remains as before and that all calculations required for the polarization are in a module separate from the main program.The most important change compared to the previous MCRT code is that we add the Stokes formalism.Each photon package in the original version of the code was characterized by its frequency, origin, and propagation direction; in the new version, the East direction d E and the Stokes Q, U and V parameters are stored as well, as motivated in P17.
In the following subsections, we describe how the effect of scattering and extinction by spheroidal grains is implemented in MCpol.First the Stokes vector must be oriented so that North is in the plane of incidence for the aligned dust grains (Sec.3.2).A photon package propagating through a cloud of spheroids continuously changes its Stokes vector (Sec. 3.3).The relationship between physical path length through a cloud of aligned spheroids and the optical depth experienced by radiation is discussed in Sec.3.4.In case the radiation interacts with the dust, a part of the intensity is either scattered or absorbed following its albedo.The albedo of the dust depends on the polarization of the incoming radiation, which further complicates the problem (Sec.3.5).If a scattering takes place, the propagation direction of the photon after the scattering is obtained via rejection sampling of the scattering Müller matrix (Sect.3.6).The polarization of photons exiting the model space is recorded (Sec.3.7).Additionally, we implement a routine to calculate the probability of directed scattering (peel-off, Sec.3.8).Finally, a routine is presented that is capabable of treating dichroism for inverse ray-tracing, which can be used for the generation of polarization maps (Sec.3.9).

Orienting the Stokes vector
The polarization of the radiation changes as it propagates through the model space.As described in Sec. 2, these changes are encoded in Müller matrices.When dealing with aligned spheroidal grains, the Müller matrices have their simplest form when the North direction of the radiation is in the plane of incidence, defined by the propagation direction of the radiation k and the symmetry axis of the grains o.
The propagation direction k, the North direction d N , and the East directions d E are unit vectors and describe a right handed coordinate system (Fig. 3), During the life cycle of a photon package, the orientation of the plane of incidence alters frequently: it changes either when the orientation of the grain's changes, e.g., when a photon package enters a new cell where the grains are oriented in a different way as in the previous cell or when the propagation direction changes e.g., after a scattering event or when a new photon gets emitted by the dust.When either of these situations occurs, we need to rotate the Stokes vector to ensure that the North direction is in the plane of incidence.We compute the normal to the plane of incidence n from the propagation direction k and the grain symmetry axis o, Let β be the angle that describes the rotation so that the North direction is in the plane of incidence.Then β is also the angle such that the East direction is perpendicular to the plane of incidence.Therefore β is the angle between d E and n.We calculate β from the two directions and the vector algebra relations, We then rotate the Stokes vector S to the plane of incidence using We would like to stress again that the plane of incidence and the angle of incidence depend on both k and o.The steps above must be repeated whenever either of them changes, that is when the photon is scattered or enters a cell with a different grain orientation or when a new photon is emitted.Note that Eq. 11 breaks down and cannot be applied when the angle of incidence is 0 • or 180 • , that is, when k and o are parallel or anti-parallel.In this case, the photon path is oriented along the spheroid's symmetry axis, and there is no preferential direction for the North or East direction.In that case, any arbitrary direction perpendicular to k can be chosen as n.

Propagating the photon package
The polarization of a photon changes when travelling through a dichroic or birefringent medium.To mathematically describe this, we consider a beam of light propagating through such a medium.Without dust emission or scattering, the polarized RT equation ( 9) simplifies to As we assume that the density, grain orientation, and the optical properties within a single dust cell are constant, this linear differential matrix equation can be solved analytically within each individual cell.Using Eq. ( 8) we obtain two coupled systems and their solution is (Lucas 2003;Whitney & Wolff 2002) The equation describes the change of the Stokes vector when the photon travels through a single cell in a dichroic or birefringent medium.The change of the Stokes vector S(s) needs to be considered in MCRT computation when the photon packets propagate by s in such a medium.We note that, whenever the photon package enters a new cell where the grain orientation is different, we need to apply a re-orientation of the Stokes vector (Sec.3.2) before we can continue the propagation.

Optical depth and path length
One necessary exercise in MC treatments is computing the optical depth along the flight path of the photon package through the cell for determining whether and where it will interact with the dust.In MCpol the grid cells are cubes with constant density n and grains have a fixed alignment.The flight path of the photon packets go along a straight line from the entry point into a cube up to either the interaction point or in case of no interaction up to the exit point of that cube.Photon packets of unpolarised light in a non-dichroic medium travel the distance from the entry point of a cube to the interaction point ∆s corresponding to an optical depth τ(∆s).This optical depth can be computed from a random exponential distribution such that the interaction of the photon package with dust in a cell follows a uniform distributed random number ξ (Krügel 2008;Witt 1977;Lucy 1999;Steinacker et al. 2013), The optical depth along ∆s is In comparison to the unpolarized light, the photon packets of polarised light in a dichroic medium travel the distance from the entry point of a cube to the interaction point ∆s pol and corresponding optical depth τ pol (∆s pol ).We add suffix pol for quantities that depend on polarization.Following Baes et al. (2019), a direct connection between the physical path length and the optical depth as given for unpolarised light is lost in media with dichroism and birefringence.Considering polarization in a dichroic medium the optical depth cannot be calculated in closed form as in Eq. ( 18).Diminishing of the polarized radiation needs to consider the change of the Stokes vector S when the photon packet travels through that cell and follows Eq. ( 16).In that solution, there is besides the extinction, which is given by an exponential decay, these additional terms of the Stokes components noted between the brackets.We visualize in Fig. 1 that dichroism indeed complicates the relation between path length and optical depth.We choose two examples of the exact solution for polarized light of Eq. 16 adopting q o = Q o /I o = 0.5 and q o = −0.1 and show the solution for unpolarized light given by exp (−τ).For better visualization, an extremely dichroic cell has been adopted with n = 0.0015, C ext = 1000, and C pol = 300 (a.u.), hence the extinction optical depth τ(1) = 1.5.Note the vast variations of the interaction points ∆s and ∆s pol for the same optical depth either τ or τ pol at same random number ξ.The interaction points are at ∆s pol = 0.47 for q o = 0.5, ∆s pol = 0.57 for q o = −0.1 and ∆s = 0.54 for unpolarized light (Fig. 1).
To stress the fact that we deal with dichroic extinction, we use the term polarization optical depth τ pol .We use the definition of an optical depth and insert Eq. ( 16) The right-hand side of Eq. 20 can, except for special cases, not be simplified.For non-spherical dust particles, there is another complication that the orientation of the Stokes vector to the grain orientation, hence the dust cross sections need to be considered.In MCpol the grain alignment in a cell is fixed, which simplifies computing the angle of incidence α, which is the angle between the Stokes vector of the incoming photon and the grain orientation (Fig. 3).The Stokes vector of the incoming photon needs to be rotated to the plane of incidence and C ext (α) and C pol (α) are computed for that α.For clarity, the angle and frequency dependence has been dropped in Eq. 20.
Whenever taking dichroism into account the polarization state changes along the flight path of the photon (Sect.3.3) and an analytical solution for ∆s pol does not exist.Baes et al. (2019) showed that the solution can be expressed by a Taylor expansion and that the extinction optical depth τ, this is the optical depth ignoring polarization approximates the polarization optical depth τ pol to first order, hence The density n of the cube, the angle of incidence α, and C ext (α) are known.As indicated by the horizontal line in Fig. 1, the same optical depth for unpolarised and polarised light are chosen by the same random number, − ln(ξ) = τ(∆s) = τ pol (∆s pol ), which leads to different path lengths ∆s ∆s pol .The distance ∆s is derived inserting the quantities n, C ext , and τ(∆s) = − ln(ξ) into Eq.17.This allows computing τ pol (∆s) using Eq.20.Hence, we derive the path length of the polarised light In the magnified examples of Fig. 1, the approximation of ∆s pol (Eq.22) is within 0.3 % of the correct solution.For typical ISM dust C pol is about a factor 100 smaller (Siebenmorgen 2022) and the uncertainty in ∆s pol is below 10 −4 .Whenever possible, the grid in MCpol is set up so that the total extinction optical depth of a cube, or when needed sub-cube, is about τ < ∼ 1. Radiation penetrating through a highly optically thick medium is challenging for MCRT codes, e.g., Min et al. (2009); Siebenmorgen & Heymann (2012); Gordon et al. (2017); Camps & Baes (2015).MC applications that consider polarization treatments at path length τ pol 1 can progressively solve the radiative transfer equation along the ray in each cube as outlined by Baes et al. (2019).This goes in hand with extraordinary boost in computing time and is not considered.Fig. 2. Visualization of the rejection sampling method.An arbitrary probability density function P(θ, ϕ) is shown in blue and the ceiling value v ceil is in yellow.An angle pair (θ, ϕ) is accepted if a third (0, v ceil ) is smaller than P(θ, ϕ).For two angle pairs, the segments in green and red visualize the ζ leading to acceptance and rejection, respectively.The case where the green line is large has a higher chance to be selected than the other case where the green line is small.For that selected case of the large green line, P(θ, ϕ) becomes also much larger than in the other case as it should be.

Dust albedo of polarized light
When the radiation interacts with a dust grain, it is either scattered or absorbed.The ratio of scattered over extincted intensity defines the albedo Λ.We rotate the Stokes vector so that its component U = 0, apply Eqs. ( 6) -( 8), and derive the albedo of a spheroid including polarization, This equation can be seen as a more general form of the albedo.For unpolarized radiation or if the polarization scattering cross-section and the dichroism cross-section are zero, Eq. ( 23) reduces to its common form.We also note that Eq. ( 23) is independent of C cpol .This is consistent with the physical meaning of C cpol : It describes a differential phase shift, a delay, between the North and East polarized parts of the radiation.Such a delay does not reduce the intensity of the radiation.

Sampling the scattering M üller matrix
In the case of non-polarized MCRT, simulating a scattering event is relatively straightforward.It essentially comes down to generating a random scattering angle θ from the scattering phase function Φ(θ).Based on the original propagation direction k of the photon package, this scattering angle can be converted to a new propagation direction k , and this describes the scattering event.
In polarized MCRT, computing a scattering event is more complicated: not only is the random generation of a new propagation direction more complex, but we also must update the polarization status and the reference direction of the photon package.
Rather than a single scattering angle, we must determine a new pair of angles (θ, ϕ).In this pair, θ is still the scattering an-gle, that is the angle between the original propagation direction k and the new propagation direction k .The angle ϕ is the azimuth of k in a coordinate system with k as polar direction and the North direction as the reference direction with azimuth zero.
The appropriate probability distribution from which the random couple (θ, ϕ) needs to generated is where This formula shows two characteristics.Firstly, the probability density function is a true bi-variate distribution that depends explicitly on θ and ϕ in a nontrivial way.Secondly, it does not only depend on the characteristics of dust grains and the grain alignment, but also on the polarization state of the photon package.
To generate a random couple (θ, ϕ) from the bi-variate probability distribution function (24) we using the rejection sampling method (Von Neumann 1951).This method is comparatively simple and is readily applicable to multivariate probability density functions (Devroye 2013;Baes & Camps 2015).A scattering angle pair (θ, ϕ) is generated and accept if another third random number ξ 3 is lower than the probability P(θ, ϕ) of scattering in this particular direction (Fig. 2).A ceiling value v ceil gives the maximum probability for any of the angles and is used to scale the third random number.The actual implementation begins with calculating two scattering angles based on uniform deviates ξ i , It is important to note here, that we sample uniform in θ, which means that we sample more angles per surface area in the forward and backward directions.This is motivated by the fact that dust grains scatter preferably forward or backwards.The sampling density must be taken into account when we calculate the probability of scattering in the direction θ, ϕ.We calculate a ceiling value v ceil , which is representative for the highest probability of scattering towards a direction ϕ, θ.Following Eq. ( 3) with the scattering matrix Z the outgoing intensity I for an incoming photon with the Stokes vector S is with Z i j (λ, α, ϕ, θ) the elements of the scattering matrix.The factor sin θ compensates for oversampling the forward and backward regions and reducing the ceiling value v ceil .The ceiling value needs to be recomputed for each scattering event, when the Stokes parameters Q, U, and V, the angle of incidence α, or the wavelength λ change.The decision of whether the angle pair is accepted is based on the third random number, with 0 ≤ ξ 3 ≤ 1.The angles ϕ and θ are accepted, if A low ceiling value v ceil , will increase the probability of accepting an angle pair.Our method of changing the sampling density is a simple approach to reduce the average number of draws until a pair is accepted.There can be more sophisticated methods, using the scattering behavior of the dust mixture used in the simulations.
After generating a random angle pair (θ, ϕ), we need to update the characteristics of the photon package.The obvious characteristic to update is the propagation direction.The new propagation direction after scattering is calculated following Eq.( 30) of P17, The polarization state of the photon package also needs to be updated since the scattering event does affect the state.The new Stokes vector becomes where the factor between the brackets guarantees that the total intensity of the photon package is conserved during the scattering event.Finally, also the East direction is updated.The convention we use is that the new North direction is in the plane of departure after scattering.This plane is given by the direction after scattering k and the symmetry axis of the grain o, similar to the plane of incidence.Therefore, the East direction after scattering is If the outgoing direction and the symmetry axis are parallel or anti-parallel, the photon package continues its path through the model space without the need to rotate the Stokes vector.

Detection of escaped photons
Eventually, photon packages will leave the model space.We record their exiting directions k and wavelengths.Photons that exit with the same wavelength and with similar angles to the simulation z-axis are binned together.For axisymmetric geometries, this method allows for the quick calculation of the spectral energy distribution of the model under different viewing angles.The Stokes vector of the photon packages is rotated upon leaving, such that North is in the plane given by the escape direction and the z-axis of the model space.This permits binning photon packages by adding their Stokes vectors and intensities.

Directed scattering (peel-off)
MCRT codes commonly allow viewing the model space from (arbitrary) directions k obs .This simulates an observation by a distant observer.The chance of a photon scattering directly towards the observer is low.We, therefore, employ the peel-off method (Yusef-Zadeh et al. 1984) in which the probability of scattering towards the observer is calculated explicitly.During the model run, we store for all scattering events the position, direction k and Stokes vector S of the photon packages before scattering.After the simulation finishes we use the scattering matrix Z to calculate the Stokes vector S obs of the radiation that would have scattered towards k obs , where C −1 sca is used as a normalization factor (see below), and ϕ obs and θ obs the angles by which the photon is scattered towards the observer.The scattering angle θ obs is calculated from the direction before and after scattering, cos θ obs = k • k obs (36) and the azimuth ϕ obs from the East direction d E and the normal to the scattering plane calculated from k and k obs , The normalization C −1 sca of the scattering matrix is essential for calculating the peel-off probability using Eq. ( 35).The scattering matrix is stored internally as a multi-dimensional array, with N θ and N ϕ elements along the respective angles (θ, ϕ).Following Eq. ( 6), the sum of the Z 11 elements over the unity sphere is N θ N ϕ C sca .The scattering probability has already been considered during the MC run and so one divides by C sca .
The intensity of the radiation that is scattered towards the observer is then the first component of the Stokes vector resulting from Eq. ( 35).The intensity of the radiation that would reach the observer has to be reduced to account for (dichroic) extinction between the point of scattering and the observer.For applying this properly we developed an inverse ray-tracing routine discussed in the following section.

Inverse ray-tracing
An inverse ray tracer is developed for calculating spatially resolved maps of the model space.For this, it is necessary to know the optical depth of a scattering event towards the observer.We compute a Stokes map by sending rays in the direction −k obs from the observer to an area of the model.Along the path of a ray, it encounters cells that are numbered by i = 1, ..., m.We calculate for each cell i the amount of radiation that would be scattered and emitted towards k obs and attenuate this according to the optical depth τ out from the present position to the entry point of the ray in the model space.The map is created by varying the position at which the ray enters the model and under the assumption that the complete model space is sampled (Heymann & Siebenmorgen 2012).
Without considering polarization, the intensity of the radiation leaving the simulation is determined by the optical depth to the edge of the model space, τ out .By stepping through the system along −k obs the optical depth increases.The ray crosses the cells 1, ..., m and in each cell i, the optical depth to the edge increases by the product of the extinction cross-section of the dust C ext,i , its density n i and the path length (∆s) i , The radiation that is scattered or emitted in cell i towards the observer with an intensity I i , will exit the model and reach the observer with the reduced intensity I i e −τ out i .When we take dichroism into account, the optical depth through cell i depends on the polarization of the radiation.In addition, the polarization of the radiation will change along k obs .Both effects are described by Eq. ( 16).One also has to consider the orientation of the grains, as they can be different for each cell.Consider the change of the Stokes vector S of the photon package on its way from cell i along direction k obs out of the model space.It is given by an initial rotation into the frame of the cell, R, and then an alternating application of a dichroic extinction step towards the edge of that cell, followed by a rotation into the plane of incidence of the next cell, and so forth until it eventually leaves the model space.This can be written as a single equation by combining Eq. ( 16) and Eq. ( 4), For each cell j with 0 ≤ j ≤ i, the rotation into the cell j−1 is R j , and R obs is the rotation of North into the reference frame of the observer.The optical depth inside j is τ ext, j = C ext, j n j (∆s) j and the dichroism and birefringence matrix is E j , where for cell j the dichroism and birefringent optical depths are given by τ pol, j = C pol, j n j (∆s) j , (42) τ cpol, j = C cpol, j n j (∆s) j . (43) The ray-tracing equation, Eq. ( 40), assumes that the photon package is emitted or scattered at the edge between the cell i and cell i + 1.This is correct for optically thin cells (τ < 0.1).
In the case of optically thicker cells, the emission is distributed along the path in cell i and needs to be integrated within cell i.
The advantage of Eq. ( 40) is that it can be evaluated while stepping along the pencil beam.The product of the matrices of the previous cells is sufficient to calculate the Stokes vector of the next cell.For cell i, the matrix of the previous cell i − 1 is multiplied by R i e −τ ext,i E i .One can store the compound matrix that is updated when entering the next cell.The compounded exponential factor of Eq. ( 40) can be stored separately to keep the entries of the matrix closer to unity and to prevent numerical instabilities.

Validation
MCRT codes need to be carefully validated.For doing this, one can often use benchmark results from existing codes for comparison.However, as scattering, dichroism, and birefringence due to spheroidal dust grains are uncommon capabilities for MCRT codes, there are no such benchmarks to reproduce.Ideally, the different functionalities are tested individually.Such a procedure simplifies the identification of potential shortcomings or even mistakes and it enables those codes with different sets of functionalities may reuse the same tests.
As advocated by P17, it is particularly advantageous to compare the results of our implementations to analytical solutions.Analytical solutions are easy to reproduce and can be used to estimate the errors of the numerical treatment.Analytical solutions are also of interest to other teams aiming to verify their MCRT codes.In this Section, we develop analytical test cases to verify our numerical implementation of scattering, dichroism, and birefringence due to spheroidal dust.The MCRT treatment of scattering by spheroidal dust (Sec.4) is confirmed using renewed versions of analytical test cases by P17 developed for spherical grains.Additional analytical test cases for estimating the numerical accuracy of MCRT codes that are treating dichroism and birefringence mechanisms are presented in Sec.5.4.
In P17 we considered radiation scattering on spherical grains and developed several test cases to validate the numerical procedure for solving this radiative transfer problem of polarized light.The analytic solutions can only be expressed exactly because single scattering in a simplified geometry is considered (Fig. 4) and electrons with their uncomplicated Müller matrix is applied.Four test cases (TC) are distinguished with analytical solutions given by P17 (Eq.44-63).Circular polarization is not considered in TC 1 -TC 3 (V = 0) but is treated in TC 4.
TC 1: In the first scenario a central point source emits unpolarized radiation.For testing the peel-off scattering procedure we select two slabs of electrons.The photons scatter once at these optically and physically thin electron slabs, which lie in the xy plane.A distant observer records the intensity, polarization degree and polarization angle of the radiation scattered off the slabs.TC 1 verifies the polarization by single scattering and the peel-off mechanism.
In the next test scenarios (TC 2 -TC 4), the central light source is replaced by a tiny cloud of electrons.They are illuminated by a collimated beam.The analytical solutions of P17 were derived for photons that encounter a first scattering event at the center and a second scattering event at the slabs (Fig. 4).
TC 2: In the second test case the direction of the collimated beam is in the same plane as the direction of the slabs.The second scattering is from the electron slab to the observer.In this configuration, scattering, the peel-off mechanism, as well as a random walk step of the photons are tested.
TC 3: In the third test case, the initial beam direction is at an angle to the plane of the slabs.The plane of scattering of the initial scattering is rotated to the plane of scattering off the slabs.The rotation leads to a variable polarization angle at the observer.
TC 4: In the final test case, the scattering properties of the particles are changed.The Müller matrix of the electrons are hypothetically changed so that radiation scattering on them can become circular polarized, hence M 34 0 and M 43 0 (Eq.3), which are for electrons zero otherwise.
We expand the test scenarios of P17, to cover the case of scattering at spheroidal dust particles.For spheres and spherelike particles, the scattering matrix is most simple when North is in the scattering plane before and after the scattering event.
In that case, the scattering matrix Z reduces to a block diagonal shape, which depends for electrons only on the scattering angle θ and is independent of ϕ, hence The geometry and our notation of the scattering process on spheroidal grains is shown in Fig. 3 and summarized in  Table A.1.In contrast to spheres, for spheroidal particles the scattering matrix is usually given for North in the plane of incidence before the scattering event and North in the plane of departure after the scattering event.
In the test cases for spheroidal grains, we use spherical grains which are treated in the computations as if they were spheroids.Therefore, an orientation o is artificially assigned to these spherical grains.The orientation o can be chosen either fixed or even at random without altering the result of the scattering computation.In addition, the scattering matrix of the spheres is multiplied by two rotation matrices R to account for the different orientations of the North direction during the scattering process on spheroidal grains.These two rotations describe the change of the North direction from the plane of incidence to the plane of scattering by the angle ϕ and the rotation from the plane of scattering to the plane of departure by the angle γ (Fig. 3).The scattering matrix Z sph of the so artificially assigned orientation of spherical particles, therefore, where x = cos 2γ, y = sin 2γ, p = cos 2ϕ, and q = sin 2ϕ.The angle γ is calculated using the angle of incidence α and the scattering angles θ and ϕ as described in Appendix A.

Numerical set-up
We verified the numerical treatment of the analytical test cases TC 1 -TC 4 as implemented in MCpol, while P17 verified them using SKIRT.The MC treatments of both codes differ in many aspects.In SKIRT various acceleration methods such as forced scattering and forced absorption are included that are not implemented in MCpol.SKIRT (Camps & Baes 2015) uses a simplified Stokes formalism, which is derived assuming spherical particles; whereas MCpol treats spheroidal-shaped particles.SKIRT and MCpol use different vectorization technologies.The model grids in both codes are different.P17 used for the test cases a grid of (601, 601, 60) cuboids each having a length of (0.003, 0.003, 3 × 10 −7 ) in arbitrary units and for each cube that includes electrons an optical depth of τ = 10 −3 .MCpol uses a cartesian coordinate system with cubes for which any of these cubes can be divided into sub-cubes.We find for the test cases a good MCpol set-up using (587, 587, 3) cubes with a side length of each cube of one.The cube in the center and cubes of the slabs are filled by electrons at an optical depth of τ = 0.5, other cubes are free of electrons and have τ = 0. Hence, the probability of multiple scattering events in cells filled with electrons is unlikely but not zero.Photons that scatter a second time either at the center or at the slabs are ignored so that one can compare the numerical results with the analytical solutions.Therefore, the choice of τ shall be done with some care.A too-low value of τ reduces the scattering probability of the photons while an increase of τ enhances the chance of multiple scattering and will lead to photons that must be ignored.
The number of photon packets launched is unless otherwise stated N γ = 2.5×10 10 .Results when decreasing or increasing the number of emitted photon packets and applying different sampling of the model space are discussed in Sect.5.3.We repeat test cases TC 1 -TC 3 of P17 using the scattering matrix Z sph and pretending that sphere-like grains have an orientation and therefore, need to be treated as spheroids.We choose the grain orientation along +ê z .

Testcases TC 1 -TC 4
We compare the numerical results of MCpol for the test cases TC 1 -TC 4 against the analytical solutions as provided in Eq. 44 -63 by P17.In Fig. 5 and Fig. 6 the analytic solutions are shown as black lines and the result of MCpol with red lines along the instrumental position x of the detector (Fig. 3).P17 derived the scattering angle θ for a given detector position, which we also label in Fig. 5 and Fig. 6, by The intensity profiles in arbitrary units are shown in the top panels of (Fig. 5).At the bottom of each sub-panel, the absolute deviation from the analytic solution is shown with blue lines and the grey-shaded areas mark relative deviations with a typical error as labelled.The left column of Fig. 5 shows the results of the first test case (TC 1).The result of MCpol jitters around the analytic solution.The middle graph shows the linear polarization degree computed using Eq. 3 in P17.MCpol reproduces the Fig. 5. Test cases 1 through 3 (left to right columns) using the spheroid-like Müller matrix (Eq.46) with assumed particle orientation along the z-axis.Intensity (top row), linear polarization degree (middle row), and polarization angle (bottom row) of the observed radiation.The panels show the analytical solution (black) and the model results (orange).The bottom panels show the absolute differences (blue) and relative differences (shaded area) between the analytic solution and the model, the magnitude of the shaded area is given in every panel.analytic solution of TC 1 to better than ±0.1% rel .We attribute residual deviations to sampling errors in the initial direction of the photons from the source and the finite size of the model grid.The analytical curves are calculated for an infinitesimal "height" of the slabs.In the numerical treatment, the photon packages that arrive at a given detector pixel have taken paths with a small but finite height.In the outer parts ( x > 0.3), these paths lead to a lower average polarization degree.In the inner parts ( x < 0.3), they lead to a higher average polarization degree.In the bottom graph, the polarization angle computed using Eq. 4 in P17 is compared to the analytic result which is 0 • .Here MCpol deviates from the analytical result in the very central region ( x < 0.1).Such inaccuracies cannot be avoided and are expected due to the set-up of the numerical grid, which is the finite height of the slabs, and the amplification of the noise for polarization degrees close to zero.
The middle column of Fig. 5 shows the result of the second test case (TC 2).The intensity curve includes the noise of several per cent and is higher than in TC 1.This is because the chance of scattering at the central cell is lower than unity.Some photons do not scatter so fewer photons propagate towards the slabs.This leads to a lower photon count at the detector.The polarization degree for TC 2 is correct to 0.1% rel (Fig. 5).As in the case of TC 1, we attribute the remaining differences to the resolution of the grid.The analytic solution of the polarization angle is zero and is shown together with the numerical solution by MCpol at the bottom of Fig. 5.
The right column of Fig. 5 shows the result of the third test case (TC 3).The intensity curve is plotted in the first row.The model results follow the analytic solution.The noise in the numerical solution is comparable to the noise found in TC 2 and with the same explanations.The polarization degree derived by MCpol is for TC 3 correct to well below 0.2% rel .As we noted in P17, the area around 0.6 ≤ x ≤ 0.7 is very difficult to treat at high precision.In this area, the scattering angle from the initial direction to the slabs changes only by 0.1 • , whereas the polar- Bottom: The absolute differences (blue) and relative differences (shaded area) between the analytic solution and the model with a typical relative error of σ (∆(x)) = 3 × 10 −4 (Eq.50) as labelled.ization degree by ∼ 40% abs .The scattering matrix is tabulated for integer angles and linearly interpolated for scattering angles in between.This comparatively sparse sampling is sufficient to calculate the correct result.In comparison to P17, we even attain a higher precision.We attribute this to the fact that the scattering matrix for spheroids not only contains the scattering but also, the rotations of the plane of scattering.In P17 we calculated the effect of the plane rotations separately.Variations of the polarization angle are shown in the third row of Fig. 5. MCpol applied to this test case follows the analytic result to the high precision of 0.1% rel .
Scattering at electrons does not lead to circular polarization, as d(θ) = 0 in Eq. ( 44).In P17 we introduced a hypothetical particle for which otherwise, these test particles behave as electrons.Such particles lead to circular polarization.They are applied in TC 4, in which the geometry of TC 3 is used.In Fig. 6 the results of TC 4 are displayed for MCpol launching the large number of N γ = 2.5×10 11 photon packets.The intensity, the reduced Stokes parameters Q/I and U/I, the linear polarization degree, the polarization angle and the circular polarization expressed as V/I is shown.MCpol (red) reproduces the analytic (black) solutions of Stokes parameters of TC 4 at high precision and for the circular polarization to better than 0.03% rel .

Numerical precision
The precision of MCpol is exemplified for computations of circular polarized light by varying the number of sub-cubes N sub of cells along the x, y, and z coordinates and the number of emitted photons N γ .The difference between the numerical model V/I MCpol and the analytical solution V/I ana (P17) is computed for the reduced Stokes parameter for circular polarized light of TC 4 The minimum, maximum and standard deviation σ of that difference ∆ are given for the parameter variations in Table 1.For the minimum number of emitted photons (N γ = 2.5 × 10 9 ) an increase of N sub from 1 to 3 does not improve the 1σ noise in the model and N γ shall be increased.Launching 10 times more photons the noise in the model without sub-cubes (N sub = 1) remains whereas it improves by a factor of 2 for the N sub = 3 and almost by a factor of 4 for the N sub = 11 model.In models without sub-cubes the location of the first scattering event, this is the blob of electrons in the center of the model space, is not well sampled.This causes a systematic error in backward scattering (θ ∼ 180 o ) at x ∼ 0. The effect is reduced by increasing the number of sub-cubes and for N sub = 11 decreases to ∆ (x ∼ 0) < 10 −3 as shown in the bottom panel of Fig. 6.Even for our choice of optically thin cubes, the detailed fine sampling impacts the precision that can be reached, and which cannot be improved by increasing simply the photon statistics (Table 1).Obviously, with an even finer grid and more photons, the precision of MCpol could be improved further at the expense of a boost in computer power.In our server environment, the latter model took (already) ∼ 200 h.For reaching similar precisions both codes show similar run times.

Dichroism and birefringence
In addition to the polarization due to scattering, we have to confirm the implementations of polarization due to dichroism and birefringence.For this a spherical distribution of dust with density n and radius r around a central source are considered.The test is performed using hypothetical dust particles which dichroically absorb and slows radiation, but which do not scatter.This is to remove any side effects from the scattering implementation.Such hypothetical dust particles are chosen to be analytically simple, The angle α is the angle of incidence (Fig. 3) and the sine and cosine make it such that the transition is smooth for sight lines around α = 0. Consider initially right-handed circular polarized radiation, S = (1, 0, 0, 1), that is travelling through the dust cloud.Its direction and the grain orientation have a constant angle of incidence α.Following Eq. ( 16), upon leaving the simulation area the Stokes vector of the photon package will be Note that in this scenario the Stokes vector depends only on α.The analytic solutions for the reduced Stokes parameters are, under the different viewing angles α towards the z-axis.We use this closed form validates the implementation of dichroism and birefringence in MCpol.
In Fig. 7 we compare the results of MCpol with the analytic solutions.In the top panel, the observed Stokes parameters are plotted, using lines for the analytic solution and symbols for the numerical results achieved by MCpol.The lower panel gives the relative error between the numerical and analytical solutions.As we bin the exiting photons using the cosine of their exit angles, there are more data points for large viewing angles than for small viewing angles.Generally, the analytic solution is reproduced to better than 5% rel .There are a few aliasing effects at 18 • , 33 • , 42 • and 61 • U/I shows a bit larger noise.We attribute this to sampling errors caused by the finite resolution of the grid.

Albedo test case
The final test confirms the correct implementation of the albedo.The albedo of spheroids and spheroid-like particles depends on the polarization of the radiation interacting with the grains.MCpol handles this using Eq. ( 23).The albedo connects the effects of scattering and extinction, and a test of the implementation needs to consider both effects simultaneously.We set up a test in which a collimated beam of right-handed circular polarized radiation propagates along an elongated dust cloud of length r.The dust cloud dichroically extinct and scatters the radiation.The orientation o of the dust particles is perpendicular to the beam (α = 90 • , Fig. 3) and no radiation scatters into the beam.The geometry of the albedo test case is illustrated in Fig. 8.We use an artificial dust grain that scatters isotropic while preserving the Stokes parameters.This is obtained by using the 4D unity matrix as the scattering matrix, The cross-sections are similar to the previous test (Eq.51), but this time with the scattering cross sections differing from zero: The Stokes vector along 0 ≤ s ≤ r in radial direction r of the dust cloud before scattering is As the beam is collimated, the inverse square law does not apply here.The scattering probability is given by Eq. ( 6), Csca = 0.1(1 + tanh(2s/r)) .The Stokes components of the radiation arriving at the detector are given by multiplying Csca with S(s), The change of the Stokes components can be illustrated as follows: The component of the radiation that is polarized parallel to the orientation o of the grains (out of the plane of the paper in Fig. 8) is extinct stronger than the component perpendicular to o.Along the path through the dust cloud, the remaining radiation is more polarized in the plane of the paper, hence Q < 0. Following Eq. 58d the circular polarization degree V/I decreases along s (Fig. 8).As the incidence of the radiation is perpendicular to the alignment (α = π/2), the phase between the two components stays constant (C cpol = 0) and the circular polarization does not turn into linear polarization (U ≡ 0).In Fig. 9 we show the results of the albedo test case solved by MCpol along with the analytic solutions.The intensity reduces by ∼ 20 % along the profile of the dust cloud.The circular polarization degree (V/I) of the radiation reduces from 1 to about 0.27.These effects follow the analytic expectation with high precision, the relative error is below 0.3%.In summary, MCpol reproduces the correct behavior of the analytic solution of the albedo test case and the numerical imprecision of the Stokes vector is low ( < ∼ 1 %).If the albedo would not favor reflecting radiation polarized perpendicular to the alignment, the reflected intensity would behave very differently.As an example, we show the analytic solution of the intensity for test particles having C sca,pol = 0.In that case, the total intensity of the beam decreases exponentially as often applied in astronomy.

Summary
We have implemented polarization of radiation by spheroidal dust considering scattering, dichroic extinction, and birefringence in the Monte Carlo radiative transfer code MCpol.We provide a detailed description of the methodology used, for which the Stokes formalism was selected.We developed paradigmatic examples for testing such numerical polarization radiative transfer models using spheroidal dust against analytical solutions.They are used to verify the correct functionality of MCpol and they may be applied by other teams to verify their codes.Further, the comparison of MCpol against the analytical solutions provides means for estimating the numerical precision.We find a typical deviation of MCpol from the analytical solution for the intensity, the linear polarization degree and angle of 0.1% and in the circular polarization of 0.03%.However, situations, e.g., at a small angle of incidence α ∼ 0 or for backward scattering (θ ∼ 180 o ), we notice larger deviations that are due to sampling errors caused by the finite size of the applied grid of the model volume.
The analytical test cases are suited to other teams for estimating the precision of their dust polarization treatments.So far, only a limited number of MCRT codes support polarization including more complicated particle geometries than spheres.This is even though extinction due to spheres cannot explain the wellestablished Serkowski curve (Serkowski et al. 1975) of the diffuse ISM.We hope that the presented examples with their attached analytical solutions will help expand the number and ease the verification of MCRT codes that treat dust polarization of more complex grain shapes.
In realistic applications, one needs to consider more appropriate dust geometries, e.g., replacing spherical with spheroidal grain shapes as a starting point.For a mix of such particles that are of different kind of carbon and silicate materials and which span a range of particle sizes and grain porosity, their optical cross sections and the scattering matrix needs to be computed, furthermore some kind of grain alignment need to be implemented.MCpol is capable of tracing the polarization due to spheroidal dust grains.The here presented and tested code is open to the community in a collaborative effort.North direction in the plane of scattering, outgoing after scattering process, Fig. 3  d

Fig. 1 .
Fig. 1.Change of Stokes intensity along a flight path of a photon along a cell.The decay of the intensity has been shown for unpolarized light (green) and polarized light (Eq.16) with q o = Q o /I o = 0.5 (blue) and q o = −0.1 (magenta).The interaction points of light with dust for random incidence ξ = 0.45 are indicated by the grey lines.
C. Peest et al.: Testing models for polarization by spheroids in opaque objects θ [ • ]

Fig. 3 .Fig. 4 .
Fig. 3. Geometry of a scattering event as used for the analytical validation in Sec. 4. A photon arrives from the right side at the grain with some initial North direction d N,init (red).Grain symmetry axis o and angle of incidence α are shown in black.Photon package initial direction k, the plane of incidence and the North direction in the frame of the grain d N are shown in orange.Scattering angles θ and ϕ and North directions d N,sca , d N,sca during the scattering process are marked in blue.The direction of the scattered photon k , exit angle γ, plane of departure, and outgoing North direction d N is shown in green.

Fig. 6 .
Fig.6.Circular polarization test case from P17 using the spheroid-like Müller matrix (Eq.46) with assumed orientation of the particles along the z-axis.We show the intensity I, Stokes U/I and Q/I, the linar polarisation degree and angle, and the circular polarization V/I.The analytic solution are indicated by the dashed lines in black and the MCpol model results in red.Bottom: The absolute differences (blue) and relative differences (shaded area) between the analytic solution and the model with a typical relative error of σ (∆(x)) = 3 × 10 −4 (Eq.50) as labelled.

Fig. 7 .
Fig. 7. Dichroism and birefringence test case.Intensity I (black), reduced Stokes Q/I (cyan), U/I (magenta), and circular polarization V/I (orange) for different viewing angles.Analytic solutions (Eq.53) are represented by lines and MCpol results by symbols.The relative error of the numerical run against the analytic solution is shown in the bottom panel using the same color code.

Fig. 8 .
Fig.8.Geometry of the albedo test case.A collimated beam passes along s from 0 to r through a dichroic dust cloud going and some of the photons are scattered to a detector.The alignment of the dust grains o is towards the reader, so perpendicular to the beam, α = 90 • .

Fig. 9 .
Fig. 9. Albedo test case.Elements of the reduced Stokes vector of photons scattered out of a cloud having spheroidal particles with C sca,pol = −0.1.Intensity using spheroids with C sca,pol = 0 is shown as a dashed line.Analytic solutions (Eq.58) are represented by lines and MCpol results by symbols.Intensities in black are multiplied by factor 11; rest of notation as in Fig. 7 and Table A.1.
esp. between North direction and the plane of incidence, β := (d E , n) γ exit angle, Fig. 3 (θ , ϕ) pair of scattering angles (θ obs , ϕ obs ) pair of angles to observer N θ , N ϕ number of bins along scattering angles ζ random number v ceil "ceiling" value for rejection sampling (maximum probability) P(θ, ϕ) probability density function s, s length of photon path through medium ∆s j length of incremental photon path in cube j ∆ 10 4 times the difference of V/I of MCpol minus the analytical solution by P17 r position vector in the medium o symmetry axis of grain along major axis, Fig. 3 k incoming photon direction, Fig. 3 k outgoing photon direction k obs photon direction towards observer d N North direction in the particle frame (plane of incidence) d N,init initial North direction, Fig. 3 d N,sca North direction in the plane of scattering before the scattering event, Fig. 3 d N North direction in particle frame (plane of departure), Fig. 3 d N,sca , we use the convention favored by the IAU (Contopoulos & Jappel 1974), which for example is not applied by PlanckCollaboration et al. (2015).Changes to the Stokes vector are described by 4 × 4 Müller matrices M,

Table 1 .
Precision of MCpol for TC 4 by varying the number of sub-cubes and emitted photons.The minimum, maximum and the standard deviation σ of the model result minus the analytical solution in V/I is specified using ∆ as in Eq. (50) .