82
Faculty of Sciences Department of Physics and Astronomy Polychromatic Monte Carlo dust radiative transfer Tine Geldof Promoter: Prof. Dr. Maarten Baes Copromoter: Peter Camps A Thesis submitted for the degree of Master in Physics and Astronomy Year 2013 - 2014

TineGeldof_Thesis fysica

Embed Size (px)

Citation preview

Page 1: TineGeldof_Thesis fysica

Faculty of Sciences

Department of Physics and Astronomy

Polychromatic Monte Carlo dustradiative transfer

Tine Geldof

Promoter: Prof. Dr. Maarten Baes

Copromoter: Peter Camps

A Thesis submitted for the degree of Master in Physics and Astronomy

Year 2013 - 2014

Page 2: TineGeldof_Thesis fysica
Page 3: TineGeldof_Thesis fysica

Contents

1 Introduction 71.1 Interstellar dust in galaxies . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2 The SKIRT program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

1.2.1 Dust radiative transfer in SKIRT . . . . . . . . . . . . . . . . . . . 101.2.2 Optimization techniques . . . . . . . . . . . . . . . . . . . . . . . . 12

1.3 Polychromatism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161.3.1 Polychromatism in SUNRISE . . . . . . . . . . . . . . . . . . . . . 161.3.2 Polychromatism in SKIRT . . . . . . . . . . . . . . . . . . . . . . . 181.3.3 Problem and solution . . . . . . . . . . . . . . . . . . . . . . . . . 20

1.4 Overview of the symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

2 Implementation of the polychromatic photon packages 232.1 The different stages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.2 Stellar emission of the photon packages . . . . . . . . . . . . . . . . . . . 262.3 Propagation through the dust . . . . . . . . . . . . . . . . . . . . . . . . . 292.4 Thermal dust emission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332.5 The dust self-absorption . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342.6 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

3 Findings 373.1 Stellar model without dust: bi-Plummer model . . . . . . . . . . . . . . . 373.2 Stellar model with dust component . . . . . . . . . . . . . . . . . . . . . . 40

3.2.1 Launching of the photon packages . . . . . . . . . . . . . . . . . . 413.2.2 Absorption of the photon packages . . . . . . . . . . . . . . . . . 423.2.3 Scattering of the photon packages . . . . . . . . . . . . . . . . . . 47

3.3 Optically thin and thick models . . . . . . . . . . . . . . . . . . . . . . . . 513.4 Splitting of the photon packages . . . . . . . . . . . . . . . . . . . . . . . 55

3.4.1 The concept of photon splitting . . . . . . . . . . . . . . . . . . . . 553.4.2 Determination of the optimal biasing limit . . . . . . . . . . . . . 573.4.3 Accuracy of the results . . . . . . . . . . . . . . . . . . . . . . . . . 63

Page 4: TineGeldof_Thesis fysica

3.5 Effects of dust self-absorption and emission . . . . . . . . . . . . . . . . . 653.5.1 Thermal dust emission . . . . . . . . . . . . . . . . . . . . . . . . . 653.5.2 Reaching internal equilibrium . . . . . . . . . . . . . . . . . . . . 69

3.6 RGB images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713.7 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

4 Discussion and future prospects 75

5 Discussie 77

2

Page 5: TineGeldof_Thesis fysica

FACULTEIT WETENSCHAPPEN

Vakgroep Vaste-Stofwetenschappen

Faculteit Wetenschappen – Vakgroep Vaste-Stofwetenschappen

Krijgslaan 281 S1, B-9000 Gent

www.UGent.be

Geachte heer/mevrouw,

Ik wil hierbij graag de toelating geven aan mevrouw Tine Geldof, studente Master Fysica & Sterrenkunde aan de Universiteit Gent, om haar masterthesis in het Engels te schrijven, gezien het internationale karakter van het thesiswerk.

Ik hoop u hiermee van dienst te zijn. Met de meeste hoogachting, Prof. Dr. Dirk Poelman Voorzitter examencommissie Fysica & Sterrenkunde

uw kenmerk

xxxxx

contactpersoon

Dirk Poelman

ons kenmerk

xxxxx

e-mail

[email protected]

datum

22-04-2014

tel. en fax

T +32 9 264 43 67

F +32 9 264 49 96

Page 6: TineGeldof_Thesis fysica

4

Page 7: TineGeldof_Thesis fysica

Acknowledgement

This master thesis is the final result of my education at the Ghent University in orderto achieve the degree of Master in Physics and Astronomy. Working on a thesis projectrequires a lot of time, energy and perseverance, but is especially intellectually stimulat-ing and challenging. This is why I would like to thank my promoter Prof. Dr. MaartenBaes, as he gave me the opportunity and courage to work on this project. I would liketo thank him for his guidance throughout the past year and in particular his ongoingenthusiastic supervision.I would like to thank PhD student Peter Camps as well, who helped me at all stagesof my master thesis. In particular his insights about the working of the SKIRT programand the Qt Creator development. It was truly a pleasure to work under his guidance.I would also like to thank my fellow student Sam Verstocken, for his insights and helpwith whatever small problem I had, and my family and other colleagues for copingwith my moments of stress during the past year.

Tine Geldof

Page 8: TineGeldof_Thesis fysica

Summary

The study of special dusty astrophysical objects in the universe - such as spiral and el-liptical galaxies, galaxy clusters and even galaxy clouds - is an important developmentin the astrophysical research of today. SKIRT, acronym for Stellar Kinematics IncludingRadiative Transfer, is an advanced 3D continuum radiative transfer code based on theMonte Carlo algorithm. A simulation consists of consecutively following the individ-ual path of each single photon package trough the dusty medium. SKIRT is one of theprograms that simulates and studies these astrophysical objects in detail and is devel-oped by the UGent astronomy department. It currently uses monochromatic photonpackages and describes their life cycle during their propagation.

The purpose of this project is to introduce an optimization technique that uses poly-chromatic photon packages in SKIRT. The main goal is to implement this method andinvestigate the advantages and disadvantages this implementation will cause. One ofthem being a reduced noise in the color images of the systems. With this technique,we hope to retrieve accurate results and improve the SKIRT code. On the other hand,inevitably problems will be encountered and discussed during this report, due to thewavelength dependence of different astrophysical parameters used in the calculations.

The stepwise implementation will be tested each time with some simple astrophysi-cal models by comparing the codes containing the monochromatic and polychromaticphoton packages to one and other. At first the stellar model will be tested without adusty medium. Further on dust will be inserted to verify the scattering and extinctionof the photon packages. A third step is to include dust emission and dust self absorp-tion - the absorption of photon packages that are emitted by the dust itself - in thesimulation. The improved program will then be tested on several models with the aimof investigating the accuracy of the results.

The source code of the adjustments in SKIRT, written in C++, will not be included in thisreport. More information about the program, the SKIRT documentation and the down-loading and installation guide, can be found at the SKIRTwebsite: www.skirt.ugent.be.

Page 9: TineGeldof_Thesis fysica

Introduction 11.1 Interstellar dust in galaxies

In order to study the structure as well as the kinematics of galaxies, we have to obtaintheir intrinsic three-dimensional distributions by deprojecting observed 2-dimensionalimages. This deprojection is no easy task and is complicated due to the effects of inter-stellar dust. This constituent of the interstellar medium consists of a variety of macro-scopic solid particles, mainly carbons and silicates. Although dust forms merely asmall fraction (about 1% or less) of the total amount of matter within galaxies, it isnevertheless a very import constituent as it affects the starlight on its way trough thegalaxy. Hence, interstellar dust affects the projections of the light distributions, giv-ing us a distorted view of the investigated galaxies. It will make many regions ofa galaxy opaque, as the stellar photons will interact with the different types of dustgrains through the physical processes of absorption and scattering. The efficiencyof these two processes, from which the combination is called an extinction process,strongly depends on the wavelength of the light which is transmitted and the prop-erties of the dust grains, e.g. their macroscopic sizes, compositions. A portion of thestellar radiation, which covers the UV and optical wavelengths, will be converted to IRand sub-millimeter radiation. In some special galaxies, it seems that even about 99%of the stellar light is converted to these redder wavelengths [Baes, 2012].Just as the light profiles of the galaxies are severely affected by the dust, the projectedkinematics are too. The stellar kinematics of a galaxy refers to the fact that the starswithin the system move in particular orbits. For each star, it is possible to determinetheir three-dimensional position and velocity. It seems that photons originating from,for example, high velocity stars in the center of opaque regions can’t reach the observer,hence they will not contribute to the line-of-sight velocity distribution (LOSVD) of thegalaxy’s spectrum. The kinematics of the galaxy will in this case be biased towardslower line-of-sight velocities [Baes, 2001].

The dust grains within the interstellar medium are found in a broad range of differ-ent types, with varying sizes, compositions, etc. In performing simulations of real-

Page 10: TineGeldof_Thesis fysica

istic models, it is necessary to account for these different dust mixtures. This can bedone by defining a number of dust types, consisting of different chemical composi-tions, densities, sizes and shapes. Each dust type will consequently be characterizedby a specific absorption coefficient, scattering coefficient and scattering phase function[Steinacker et al., 2013]. These dust properties will be explained later on in this thesis.Accounting for different dust mixtures however complicates the deprojection calcula-tions even more and will hence not be considered in this project.

A spiral galaxy viewed from its side, at an inclination of nearly 90 degrees, is referredto as an edge-on spiral galaxy. A special feature of these galaxies is that they seem tobe optically thick in their central regions and optically thin in the outer regions. Thereason for this is that a spiral galaxy contains interstellar dust that predominantly lieswithin a thin disk narrower than the stellar disk [Baes, 2012].Edge-on spiral systems can easily be used to investigate the effects of dust on their ra-diation field, as the dust extinction in the plane of this galaxies will add up along theline of sight. This results in prominent dust lanes which are visible as thin, darkenedbands in the UV or optical window, running through the galaxy’s center. This featureis clearly displayed in figure 1.1, where the bulge fraction and the amount of dust isvaried from the top left to the bottom right. When increasing the dust fraction in thedisk of the galaxy, the dust lane becomes clearer. Due to the typical thermal emission ofthe dust grains, these dusty bands can also be seen at infrared or sub-millimeter wave-lengths when making use of the appropriate telescopes or simulations which includedust emission.

Figure 1.1: Models of an almost edge-on spiral galaxy with an inclination of 88, in which theeffects of extinction is examined. From left to right an increase in the amount of dust in the diskis shown, while from top to bottom a growing bulge fraction is represented. [Baes, 2012]

8

Page 11: TineGeldof_Thesis fysica

A sophisticated deprojection technique that takes dust absorption, emission and scat-tering into account makes use of the so called radiative transfer equation (RTE), whichin a macroscopic way describes the interaction between matter and radiation. Solvingthis equation is called the RT problem, as it governs the physical process of depro-jection. As information is given in an observed image on the plane of the sky, i.e. atwo-dimensional projection of a 3D structure, the inverse RT problem must be solvedto obtain the 3D distribution of the examined stellar system. This can be done by acouple of different numerical methods that make use of the RTE: an iteration method,a method based on the expansion in spherical harmonics, a discretization method anda Monte Carlo technique [Baes and Dejonghe, 2002b]. In this project, the Monte Carlomethod is of most importance, as it can be used to investigate more complex geome-tries. Moreover, the program that is edited and used in this thesis in particular utilizesthe Monte Carlo technique to execute the different simulations.

9

Page 12: TineGeldof_Thesis fysica

1.2 The SKIRT program

SKIRT, acronym for Stellar Kinematics Including Radiative Transfer, is an advanced 3Dcontinuum radiative transfer code based on the Monte Carlo algorithm. The first SKIRTversion, written in Fortran 77 and developed by the UGent astronomy department,was developed in 2001 to study the effect of dust absorption and scattering on the ob-served kinematics of early-type galaxies [Baes and Dejonghe, 2002a] [Baes et al., 2003].Later on, new versions of SKIRT where developed in C++ which focused on dust ab-sorption, scattering and thermal re-emission [Popescu and Tuffs, 2005] [Baes et al., 2005].The latest version that will be used throughout this report, SKIRT6, contains the mostrecent functionalities that can easily be edited and updated with new features in theQt creator development environment [Baes et al., 2011]. Furthermore, the code is par-allelized using Q Threads. This parallelization technique significantly improves thespeed of the complicated calculations performed in the code.In SKIRT6, the simulation starts from a 3D model for the stellar objects and dusty sys-tems. The different parameter values describing the model are stored in a ski file, i.e.a file with the ”.ski” extension. Using the Monte Carlo technique, it can calculate theintrinsic properties, e.g. the strength of the radiation field, dust temperature distri-bution, etc., and the observable properties of the models, e.g. images of the galaxies,SEDs (Spectral Energy Distributions), etc. These calculated results are all outputted viaASCII files and FITS (Flexible Image Transport System) images.

1.2.1 Dust radiative transfer in SKIRT

The key principle in Monte Carlo radiative transfer simulations is that the radiationfield is treated as a flow of a finite number of luminosity packages, with the entire lu-minosity divided among these packages. The simulation itself essentially consists offollowing the individual path or life cycle of each single photon package trough thedusty medium [Steinacker et al., 2013].We can consider one of the many photon packages emitted by a stellar object, consist-ing of a (large) number of photons with the same wavelength. Note that, from now on,a single photon package will sometimes be referred to as a photon, while in principlethese two are not the same. In the simplest case, this package can be characterizedby a luminosity Lλ, a position x of the last emission or interaction and a propagationdirection k. The space is divided into a number of cells with a uniform dust densityattached to each cell. The path of the package is given by a straight line until it interactswith a dust grain -it can be scattered or absorbed- or leaves the dusty medium.The firstMonte Carlo step is to initialize these three properties.

10

Page 13: TineGeldof_Thesis fysica

Initialization

The initial luminosity is defined trough the total luminosity of the stellar object and thenumber of photon packages Npp in the simulation:

Lλ =Ltot

λ

Npp(1.1)

This gives every photon package the same luminosity. The initialization of the posi-tion x and direction of emission k is done randomly. A random position is generatedfrom the 3D stellar distribution and the propagation direction is defined by choosing arandom position on the unit sphere, as stars typically emit radiation isotropically.

Determination of the interaction point

The second Monte Carlo step is to determine whether the photon package will interactwith a dust cell or will leave the system. To do this, we need the specific intensityIλ, a conserved quantity that is defined as the intensity per unit of wavelength. Thespecific intensity represents the amount of energy that is carried by radiation for agiven wavelength per unit of solid angle and per unit of time, crossing a unit areaperpendicular to the propagation direction. It is thus defined by:

dE = IλdA⊥dΩdλdt

The radiative transfer equation for one photon package will be given by:

dIλ

ds= −κλρIλ (1.2)

where κλ is the extinction coefficient of the dust at a given wavelength, ρ is the dustdensity and s is the path-length covered along direction k from the starting point x.The interaction coefficient κλ corresponds to the opacity of the dust, which can be in-terpreted as the impenetrability of the medium and has a contribution of the absorptionand scattering processes, hence κλ = κsca

λ + κabsλ . The radiative transfer equation 1.2 or

RTE can be solved as:Iλ(s) = Iλ(0)exp(−τλ) (1.3)

Where we have introduced the optical depth along this particular path as:

τλ(s) =∫ s

0κλρ(s′)ds′ (1.4)

11

Page 14: TineGeldof_Thesis fysica

A random interaction point can now be determined by generating a random opticaldepth τλ from the probability distribution function (PDF), that is given by an exponen-tial distribution:

p(τλ)dτλ = e−τλ dτλ (1.5)

Comparing this random optical depth τλ with the maximal optical depth τλ,path, givenby equation 1.4 with s going to infinity, determines whether the photon package willinteract or not. If τλ > τλ,path, there will be no interaction and hence the photon pack-age will leave the system. If τλ < τλ,path, an interaction will take place at positionxint = x + sk, where the physical path length s will be determined by the inverseformula of equation 1.4.

Nature of the interaction

Deciding the nature of the interaction, i.e. whether a scattering or absorption processtakes place, is done by defining a fraction aλ given by:

aλ =κsca

λ

κscaλ + κabs

λ

, (1.6)

where κscaλ is the scattering coefficient of the dust and κabs

λ the absorption coefficient.The fraction aλ is called the dust grain albedo. The nature of the interaction is in thiscase not chosen randomly. Instead, the photon package will be split into two parts. Onepart with weight 1− aλ is absorbed such that a luminosity (1− aλ)Lλ is stored in theabsorbed luminosity counter of the particular cell where the interaction happens. Theremaining part with weight aλ is scattered and the Monte Carlo loop for the photonpackage will continue with a reduced luminosity of aλLλ. A new random directionwill be generated and the propagation of the luminosity package continues on a newpath. When a photon package holds only 0.01% or less of its original luminosity, thepackage vanishes and its life cycle is ended [Baes et al., 2011].

1.2.2 Optimization techniques

As the simple Monte Carlo Radiative Transfer method works well for 1D simulations,it is particularly inefficient for general 3D geometries of the stars and dust. Severaloptimization techniques are developed to eliminate these inefficiencies: continuousabsorption method, forced scattering, peel-off technique and polychromatic photon packages[Steinacker et al., 2013]. They are all summarized in figure 1.2 and will be further ex-plained in this subsection. Notice that the absorption-scattering split method of the pho-ton packages, explained in subsection 1.2.1 where the nature of the interaction was

12

Page 15: TineGeldof_Thesis fysica

Figure 1.2: Different optimization techniques in the Monte Carlo Radiative Transfer method.The red cells show the continuous absorption of the photons. The pink arrows represent theforced scattering technique. The light blue and orange arrows represent the peel-off techniques.[Steinacker et al., 2013]

treated, is an optimization technique as well, as it tries to maximize the functionalityof one photon package.

Continuous absorption

The Monte Carlo Radiative Transfer method can be enhanced by absorbing along thepath of the photon package, instead of absorbing only at the interaction site. In thismanner, there will be less noise created by the simulations while using the same amountof packages. This continuous absorption occurs along the entire path, such that thephoton is split into N+2 different parts, with N the amount of dust cells along thephotons path:

Wesc = e−τpath , (1.7)

Wsca = a(1e−τpath) , (1.8)

andWabs,n = (1− a)(e−τn−1 − e−τn) (1.9)

One part Wesc will leave the system, one part Wsca is scattered at the interaction locationdetermined in section 1.2.1, and N parts Wabs,n are absorbed in the nth cell. In theabove equations, τn gives the optical depth measured from the photons location to thesurface of the nth cell. The parameter a is the dust grain albedo, this is the fraction ofthe photon that is scattered during an interaction process. Note that the part that will

13

Page 16: TineGeldof_Thesis fysica

be scattered is the actual part of the photon package that survives and continues in thelife cycle.The strength of the continuous absorption optimization method lies in the fact thatall photon packages contribute to the calculation of the absorption rate of each cellthey pass through. This is particularly useful for systems which are optically thin, asotherwise they would have very few absorptions in the simple MC approach.

Forced scattering

In the SKIRT program a concept of forced scattering is used such that every ray isforced to contribute to the scattered flux. Otherwise, in a system which would beoptically thin, most photon packages would leave the system without any interactionand are hence wasted. In the forced scattering method, the exponential distributionp(τλ) given by eq. 1.5 is replaced by the adjusted distribution q(τλ), which is assignedwith a weight W f s =

p(τλ)q(τλ)

= 1− e−τλ,path .

q(τλ)dτλ =

e−τλ dτλ

1−e−τλ,path(τλ < τλ,path)

0 (τλ > τλ,path)(1.10)

In this equation, the cut off implies that when a random optical depth τλ larger thanτλ,path is generated, the exponential distribution q(τλ)dτλ = 0. In other words, whenan interaction point outside the system is generated, the probability of scattering atthat location is zero. This method forces the simulation to generate a random opticaldepth τλ that is smaller than τλ,path, and hence an interaction site that is smaller thanthe system itself.

Peel-off technique

Simple MCRT is completely inefficient in building up observable images/SEDs, asonly the photons that are emitted from the system in the direction of the observercontribute to the output appearance. This flaw can be eliminated if we require that allphotons directly contribute to the output images, by creating peel-off photon packagesafter every emission or scattering. The peel-off photon packages contain a portion ofthe luminosity of the original photons, which emerge into the direction of the detectioninstruments. This luminosity fraction is estimated by defining the weight factor of aphoton in the direction of the observer:

Wppp = p(nobs)e−τobs (1.11)

14

Page 17: TineGeldof_Thesis fysica

where τobs is the optical depth from the position of the emission or scattering event andp(nobs) is the probability that the photon will be directed toward the observer. Whengathering all the information of the peel-off photons, the observed results of a real CCDcamera can be mimicked, images and SEDs of the models can be created.

Polychromatic photon packages

The last but most crucial optimization technique for this report is the usage of poly-chromatic photon packages within the panchromatic simulations. In this case, photonpackages are emitted which contain photons at many different wavelengths simultane-ously, instead of only one wavelength independently. This technique is still controver-sial as it is not clear that it actually will reproduce accurate results. The main concern ofthis project is to implement the polychromatic photon packages in the SKIRT programand investigate the pros and cons of the technique. One of the expected benefits is thatthe usage of these polychromatic photons will speed up the simulations. The MC runwill be simultaneously solved at all wavelengths, instead of a run for each wavelength.Another expected benefit is the reduced noise in the color images. If monochromaticphoton packages are used, it could be the fact that a certain arbitrary pixel in the RGBimage is blue while its neighboring pixel is red. However, when polychromatic pho-ton packages are used, every photon calculated can contribute to the output imagesat all wavelengths instead of a single wavelength. In this way, a certain pixel in theimage will have a contribution of several colors. A detailed explanation how the con-cept of polychromatic photon packages precisely works is given in the next section,where-after the implementation and results will be discussed. The main focus will bethe accuracy of the simulations using polychromatic photon packages. This precisionwill be investigated by comparing the adapted simulation with the original one andby statistically calculate the noise and dispersion on it.

15

Page 18: TineGeldof_Thesis fysica

1.3 Polychromatism

1.3.1 Polychromatism in SUNRISE

The optimization method that makes use of polychromatic photon packages explainedin subsection 1.2.2 has already been implemented and tested before in a free MonteCarlo dust radiative transfer code called SUNRISE [Jonsson, 2006]. In the article writtenabout this concept, P. Jonsson insures that the use of polychromatic photon packagessignificantly improves the calculations in efficiency and accuracy for spectral features.One of the results he obtained is shown in figure 1.3, where the difference between theresults using SUNRISE and the RADICAL [Dullemond and Turolla, 2000] code are plottedas function of wavelength for four different optical depths. It is shown that his resultsagree well for small optical depths, which means that he obtained accurate results foroptically thin systems. However, for larger optical depths, and especially for the edge-on configurations, the relative differences reach±40%, which is larger than the internaldifferences between the codes. Stratifying the calculations into two wavelength rangesinstead of one solves this problem of high discrepancies, making the results agree verywell with the monochromatic results.

To investigate another advantage of polychromatism, P. Jonsson tried to quantify therelative efficiencies of two methods by defining the efficiency ε as

ε =F2

λ

Tσ2Fλ

,

where T was the CPU time required to complete the calculations and σFλthe Monte

Carlo sampling uncertainty in the SED. Hence, the efficiency quantifies the inverse ofthe CPU time necessary to produce results of unit relative accuracy, independent to thenumber of rays traced. The results of the efficiency of the monochromatic and poly-chromatic methods he obtained in function of wavelength are shown in figure 1.4. Itseemed that for low optical depths, i.e. τν <10, the efficiency of the polychromatic al-gorithm (solid lines) exceeds that of the monochromatic one (dashed lines). For τν=10the efficiency of the monochromatic method overtakes the polychromatic one at longwavelengths and for τν=100, i.e. a very high optical depth, this becomes the case forshorter wavelengths as well. When P. Jonsson uses stratified polychromatic calcula-tions, an efficiency greater than the monochromatic calculations are obtained.

16

Page 19: TineGeldof_Thesis fysica

Figure 1.3: Difference in SED between results from SUNRISE and RADICAL. The results of thepolychromatic algorithm are indistinguishable from those obtained with the monochromaticalgorithm. For the optically thick case stratified polychromatic calculations are used to avoidthe problem of diverging results.[Jonsson, 2006]

In this thesis, we will investigate if similar benefits as obtained in SUNRISE can beachieved when this optimization technique is implemented in SKIRT. Our main goalis to look at the obtained accuracy of the calculations when the polychromatic algo-rithm is used. As the code will probably not be implemented on the most efficientway, it will not be possible to compare the speeds of the codes based on the monochro-matic and polychromatic method. Hence, we won’t be focusing on the efficiency of thecode, making it impossible to investigate this expected advantage of the optimizationtechnique.

17

Page 20: TineGeldof_Thesis fysica

Figure 1.4: Efficiencies of the polychromatic (solid lines) and monochromatic (dashed lines)method. The stratified polychromatic calculation is shown as a dot-dashed line. For loweroptical depths, the efficiency of the polychromatic algorithm exceeds that of the monochro-matic one for all wavelengths. For high optical depths, the stratified calculations are needed tomaintain a lower efficiency than in the monochromatic case.[Jonsson, 2006]

1.3.2 Polychromatism in SKIRT

In the monochromatic case, every wavelength is treated independently, which is pos-sible because scattering by dust grains is an elastic process. Here we introduce andimplement a polychromatic algorithm within the panchromatic simulation of SKIRT.As in this case every ray samples every wavelength, the Monte Carlo Radiative Trans-fer calculations will be solved simultaneously at all wavelengths. The photon packageswill contain a list of luminosities, each corresponding with a certain wavelength. Toavoid unnecessary calculations, a minimum and maximum wavelength are identifiedas properties of the photon package, where above and below the given luminosities arezero. A reference wavelength is indicated as a characteristic of the photon packages forthe use in the simulation of the propagation and scattering processes. An experimentalguess for this reference wavelength lies halfway the optical range, at about 0.55 micron,as the stellar emission of photon packages mostly cover the optical range. This valueat the center of the V-band range is a good guess for the stellar emission phase, butwhenever the thermal dust emission is taken into account, this reference wavelengthshould be set halfway the IR wavelengths, as photons emitted from dust grains mostlycover this range.The polychromatic photon packages in SKIRT now include 9 characteristics:

• A luminosity vector, containing every wavelength dependent luminosity Lλ, or-dered from the lowest to the highest wavelength contained in the simulation.From this vector, the total luminosity Ltot of the package can be estimated.

18

Page 21: TineGeldof_Thesis fysica

• A constant Nlambda, referring to the amount of wavelength bins included in thesimulation.

• The minimum wavelength index, for which lower wavelengths contain lumi-nosities equal to zero.

• The maximum wavelength index, for which higher wavelengths contain lumi-nosities equal to zero.

• The reference wavelength index, from which the random interaction opticaldepth and random scattering phase function will be drawn. This will be set to avalue of 0.55 µm in the stellar emission phase, e.g. halfway the optical range.

• The position x of the photon package, which refers to a location in the systemwhere the last process took place.

• The propagation direction k of the photon package.

• A flag returning true or false, indicating its origin, i.e. if the package is emittedby a star or by a dust grain.

• A counter indicating the number of scattering events that the photon packagehas already experienced.

Note that the selected range of wavelengths will be divided in bins, such that every binrepresents a certain wavelength group in the simulation and is treated as one wave-length in the calculations. Increasing the required number of bins will hence increasethe accuracy of the calculations.

The polychromatic photon packages are relevant only within the panchromatic mod-eling. A panchromatic simulation constructs a 3D model for the stars and dust fromwhich it can reproduce the observed images and SEDs over the entire electromag-netic spectrum. The simulations usually span over the UV and sub-millimeter wave-length bands, including absorption, scattering and thermal emission by dust grains[Camps, 2013]. Hence, the implementation of the polychromatic photon packagesshould be within the PanMonteCarloSimulation class. SKIRT also offers another type ofMonte Carlo simulation that operates at only one or more distinct wavelengths ratherthan a discretized range. Such an oligochromatic simulation does not include thermaldust emission. Necessary adjustments in sub- or super classes commonly used in boththe panchromatic and oligochromatic simulation will thus not work for the latter, e.i.the OligoMonteCarloSimulation class.

19

Page 22: TineGeldof_Thesis fysica

1.3.3 Problem and solution

Using a reference wavelength for each photon package is rather a tricky technique, asit can induce a big problem. The probability distributions, from which the interactionoptical depths -or thus the path lengths- and the scattering directions of the photonpackages are sampled, are wavelength dependent. For example, rays of shorter wave-length will tend to travel shorter distances before interacting, as the dust opacity in-creases towards these wavelengths. Thus, two important astrophysical quantities usedin the propagation and scattering of the photon package, namely the interaction opticaldepth τλ and the scattering phase function Φs(θ, λ), depend on wavelength but will besampled only for the reference wavelength. These probability distributions will conse-quently only be precisely correct for this reference wavelength, while they will deviatefrom the exact values at the other wavelengths.

The ability to use biased distributions will make an attempt to compensate for thisproblem. The intensity of the ray, corresponding with a certain wavelength, will bealtered at the point of interaction by use of a weight factor wλ. This biasing factor isshown for the forced scattering case in eq. 1.12, where eq. 1.10 is used to calculate thequotient of the probability distributions.

wλ =q(τλ)

q(τre f )= eτre f−τλ

[τλ

τre f

] [1− e−τre f ,path

1− e−τλ,path

](1.12)

This biasing factor is of course equal to unity for the reference wavelength. Note thatτλ,path is the total optical depth for a given wavelength λ from the point of emissionto the edge of the medium in the direction of propagation. As a part of the ray willinteract somewhere along the path, the optical depth of the interaction τλ is randomlydrawn in the range [0, τλ,path].The probability of scattering in a certain direction is given by the scattering phase func-tion Φs(θ). In the polychromatic simulation, the scattering angle θ will be drawn fromthe reference wavelength λre f . The biasing factor which should be used to multiplywith the ray intensity after scattering is then given by eq. 1.13.

wλ =Φs(θ, λ)

Φs(θ, λre f )(1.13)

Note that the errors for a fixed number of rays will probably increase for wavelengthswhere the dust opacity is very different from the one at the reference wavelength.Wavelengths at the outermost regions will have biasing factors who deviate the mostfrom the reference weight factor, namely 1. This complication can make the biasing

20

Page 23: TineGeldof_Thesis fysica

factors very large, which can dominate the results at these particular wavelengths[Jonsson, 2006]. A proper choice for the reference wavelength is hence crucial for theaccuracy of the method. This should be chosen experimentally, such that the range ofweighting factors encountered in the problem is minimized.It is not always so easy to select an ideal reference wavelength that won’t be influencedby the above mentioned problem. In some models, for example very optically thickones, the value of the weight factor in eq. 1.12 will increase without bound. A possiblesolution is to consider partly polychromatic photon packages, which contain a smallerrange of wavelengths and thus not the whole electromagnetic spectrum. This can bedone by calculating the biasing factors before the propagation and scattering processesare done. When these weight factors deviate to much from unity - the magnitude ofwλ,re f - the photon package can be split into two or more packages, containing a part ofthe luminosity vector of the original one. This method will be referred to as the photonsplitting technique. New reference wavelengths will be calculated for these split lumi-nosity packages, lying between there minimal and maximal wavelengths.The difficulty lies now when to decide whether the biasing factor is too high. Thehigher these factors become, the less accurate the calculations will be. On the otherhand, setting a strict limit to these factors will result in a great amount of photons split,which will slow down the calculations. This is why a certain deviation from unityshould be chosen, which gives a good balance between the speed of the calculationsand the accuracies they reproduce.

21

Page 24: TineGeldof_Thesis fysica

1.4 Overview of the symbols

The symbols that are used in the previous sections for the description of the radiativetransfer algorithm and that will return in the following sections are briefly summa-rized in the table below. Mark that, except for the position, propagation direction andbiasing limit, there is a clear dependence on wavelength in the rest of these quantities.

Symbol Description

x Photon package’s position of the last emission or interaction.

k Propagation direction of the photon package from a certain position x.

κ Dust opacity or interaction coefficient per unit mass.

a Dust grain albedo (the fraction of the photon that is scattered during

an interaction).

τλ,path Total optical depth of a photons path for a wavelength λ: from the point

of emission to the edge of the medium.

τλ Randomly drawn interaction optical depth at wavelength λ.

Lλ Luminosity of the ray at a wavelength λ.

Ltot The total luminosity (for all wavelengths) of a photon or system.

wλ Biasing factor used to alter the luminosity Lλ when the position of

interaction or the scattering angle is drawn at the wrong wavelength λre f

bdev Limit that will be set to retrain the magnitudes of the biasing factors.

Ftot,λ Total flux of the system at wavelength λ.

Ftrans,λ Total flux of the system at wavelength λ without consideration of dust.

Fdir,λ Flux of the system at wavelength λ reaching the detectors directly

and influenced by extinction, but not scattering.

Fsca,λ Scattered flux of the system at wavelength λ.

Fdust,λ Flux of the system emitted by the dust at wavelength λ.

22

Page 25: TineGeldof_Thesis fysica

Implementation of the polychromatic photon packages 22.1 The different stages

In this section, a brief explanation of the different stages that follow each other in thepanchromatic simulation will be itemized. In this way, a clear view can be createdabout the construction within the SKIRT code.

SKIRT actually starts the panchromatic simulation by activating the stellar emissionphase. This stage, in the code run by the runstellaremission function, starts and sim-ulates the life cycle of every photon package. In particular, the function gives birth toall of the luminosity packages and, after the radiation emerging towards the detectioninstruments has been estimated, begins its propagation trough the dust. The photon’slife cycle is schematically explained in figure 2.1. How the birth and initialization ofthe photons is established will be the topic of section 2.2. There, an unrealistic modelwill be put together which doesn’t contain dust in its system.As soon as the panchromatic simulation includes a dust system, which usually is thecase in all types of stellar objects, dust absorption and scattering will be automaticallyenabled. The stellar emission phase will simulate the propagation through this dust byentering a cycle consisting of five different steps. These steps will be explained in moredetail in section 2.3.

When all photons terminate their life cycles and a dusty medium is present in thesystem, the next stage of the simulation is activated. This is the so called dust self-absorption phase. It will simulate the continuous emission and re-absorption of photonpackages through the dust grains. Because this particular phase of the simulation,described in the rundustselfabsorption function, is only possible when dust emissionis taken into account, it will be treated in one of the last parts of this thesis (section2.5).

The final phase of a panchromatic simulation is the dust emission phase. This will beexplained in section 2.4 and is driven by the rundustemission function. In this stage,the absorbed luminosity of the entire simulation, with or without dust self-absorption,is estimated in such a way that the dust can begin its thermal emission. The photons

Page 26: TineGeldof_Thesis fysica

launch

Peeloffemission

fillDustSystemPath

simulateescapeandabsorption

is Ltot > Lmin?

simulatepropagation

peeloffscattering

simulatescattering

yes

no

Terminate

life cycle

Figure 2.1: The life cycle of an individual photon emitted by a stellar object. This figure showsschematically the successive functions called in the stellar emission phase. The same order offunctions (except for calling the launch function) and terminating condition will be used inthe dust self-absorption and dust emission phases. Mark that in the dust self-absorption phase nopeel-off photons are created.

which underwent interstellar reddening will leave the system and peel-off packagesare created. Note that if the simulation covers UV and optical bands only, dust emis-sion will most likely be irrelevant.

Parallelization

The Monochromatic Radiative Transfer code in SKIRT, i.e. every stage explained above,is currently parallelized using multiprocessor threading. This type of programming al-lows multiple threads to exist within a single process. The threads will share the sameprocess’ memory, but are able to perform calculations independently of each other[Quinn, 2004]. This type of shared memory parallelization is called task or control par-allelism and will split the different levels of iterations in the MC run over differentnodes. In such way, the SKIRT program can simulate the life cycles of different photonpackages simultaneously, by distributing them over all available threads. This tech-nique significantly improves the speed of the calculations and is therefor extremelyuseful for a very CPU time demanding simulation. Note that in the near future, oneof the planned developments of SKIRT is to use MPI (Message Passing Interface) fordata parallelism, in order to allow Monte Carlo simulations to be run on distributedmemory systems [Baes et al., 2011]. This should speed up the calculations even morewhen simulating on supercomputers.

24

Page 27: TineGeldof_Thesis fysica

The main task parallelism of the original SKIRT version is situated in the loop overwavelength. This implies that SKIRT runs both the stellar and dust emission phases atdifferent wavelengths simultaneously. When polychromatic photon packages are im-plemented, the iterations in the stellar and dust emission phases will be over differentphoton packages instead of different wavelengths. A quick adaptation must be madein order to construct a loop over packages containing all wavelengths.

25

Page 28: TineGeldof_Thesis fysica

2.2 Stellar emission of the photon packages

As the photon packages begin their life cycles, they are born or launched from the stel-lar system that is specified by the user. After being created, an optimization techniqueis called for the first time in which another, peeled-off photon is stripped off the origi-nal photon packages. These two procedures will be called only once for every photonpackage.

launching of the photon packages

This particular feature is done by the launch function, who initializes all the proper-ties of a newborn photon package. There are essentially four stellar systems wherethe launching function is implemented, here itemized as their classes are called in thecode:

• AdaptiveMeshStellarSystem: this class represents stellar systems defined by thestellar density and properties, such as the metallicity Z of the stellar populationor there age, imported from an adaptive mesh data file.

• CompStellarSystem: this class represents stellar systems that are the superposi-tion of a number of components. The individual components are defined inter-nally as objects of the StellarComp class.

• SPHStellarSystem: this class represents stellar systems defined from a set of SPH(Smoothed Particle Hydrodynamics) star particles, such as for example resultingfrom a cosmological simulation. The information on the SPH star particles is readfrom a file.

• VoronoiStellarSystem: this class represents stellar systems defined by the stellardensity and properties, such as the metallicity Z or the age of the stellar popula-tion, imported from a Voronoi mesh data file.

In general, all these stellar systems feature approximately the same launching functionto set up a photon package consisting of its 9 initial characteristics described in sec-tion 1.3.2. The flag that returns the origin of the photon is set true, as it is born andemitted from the stellar object itself. As explained in section 1.2.1, the initial positionand direction of the photon are generated randomly. An ordered table of floating val-ues, called the normalized cumulative total luminosity vector, must be created. Thisis for initializing the photons position, as this vector is used to identify in which cellor in which stellar object the emission takes place. Calculating the total luminosityof each cell or object, the normalized cumulative total luminosity vector will have the

26

Page 29: TineGeldof_Thesis fysica

following form:

Xtot =

0,

Ltot,1

Ltot,

Ltot,1 + Ltot,2

Ltot, ..., 1

Here, the total luminosities Ltot,i over each wavelength range belong to every cell orobject independently, while Ltot is the total luminosity of the entire system. A particu-lar cell or object can refer to different aspects, depending on the stellar system that isused in the simulation. In the case of an Adaptive Mesh or Voronoi stellar system, thesecells are in fact Mesh cells. A random Mesh cell will be determined from the abovenormalized cumulative total luminosity matrix, allowing us to determine a randomposition within this cell’s boundaries. When using a SPH stellar system, the i’th ob-ject represents the i’th SPH particle. Once a random SPH particle has been chosen, aposition is determined randomly from the smoothed distribution around the particle’scenter. Finally, the objects can also refer to different stellar components. In this case,the position of emission is determined randomly from the geometry of the i’th stellarcomponent.A luminosity vector for the photon package is created within this launch function,determined by:

Lλ = Lλ,iLtot

Ltot,i

1Npp

Hence, when a photon package is located at a position x within the i’th cell/object,its luminosity at wavelength λ is equal to the luminosity of the cell/object at that par-ticular wavelength, normalized with respect to the total luminosity of the system (thetotal luminosity of all cells or stellar objects) by the factor Ltot

Ltot,iand divided by the

total amount of photon packages. Because of this, the minimum and maximum wave-lengths, below and above which now luminosities are found, are equal to those de-termined by the i’th cell/object. The value of the reference wavelength is not yet ofimportance, but will be at later stages of the simulation. For ease, this property is setto the value closest to the wavelength bin containing 0.55 µm.

Creating peel-off photon packages

After the stellar photon packages are emitted by the adapted launch function, thepeeloffemission is called to estimate the emerging radiation in the direction of thedetection instruments. One peel-off photon package is created for each instrument,having 9 equivalent characteristics of the original polychromatic photon package. Onlyone property, the propagation direction, is altered into the direction of the observers.As the stellar emission is considered to be isotropic, no extra weight factor should beused to compensate for the luminosities emerging in that particular direction. In otherwords, the probability that the photon would have been emitted towards the detection

27

Page 30: TineGeldof_Thesis fysica

instruments in eq. 1.11 is equivalent with the probability that it is emitted in any otherdirection. The instruments detect one wavelength at a time (just as in the monochro-matic case), such that a loop over the wavelength indexes should be added in the codeof the peel-off technique. Mark that this loop will only cover the range of wavelengthscontaining luminosities different from zero, indicated by the peel-off photons mini-mum and maximum wavelength indexes. This is useful as it excludes unnecessarycalculations.

28

Page 31: TineGeldof_Thesis fysica

2.3 Propagation through the dust

A second step in the implementation is to add a dusty medium to the simulation of astellar object, which will cause scattering and extinction of the emitted photon pack-ages when they propagate trough this medium. The inclusion of dust can be chargedby the user when setting up the ski-file. The life cycle of a photon package in a dustsystem after it has been launched by stellar emission is summarized in the box below.This five procedures will be iterated until the polychromatic photon package vanishes,disposing of a total luminosity that has decreased below its critical value.

fillDustSystemPath

simulateescapeandabsorption

simulatepropagation

peeloffscattering

simulatescattering

Filling the system with dust

The first aspect that must happen after the emission of the photon package, is thatits path must be filled up with dust. This is being done in the fillDustSystemPath

function, by calculating the information, in particular the optical depth, on the pathof the photon package through the system of dust and storing it in a so called Dust-

SystemPath object. This calculation is done for every photon package and will still beperformed for every wavelength independently, lying in the range of the minimal andmaximal wavelength indexes indicated by the package. This means that only a smallloop that runs over the wavelengths of the photons must be added in the fillDust-

SystemPath function.

Simulating the escape and absorption of the package

Next, the optimization technique called continuous absorption, demonstrated in figure1.2, is performed by the function simulateescapeandabsorption. This feature willsimulate the escape from the system and the absorption by the dust of a fraction ofthe wavelength dependent luminosity of a photon package. It actually splits this lu-minosity Lλ in N+2 different parts, as explained in section 1.2.2, with N the number ofdust cells along the photons path. The part that scatters is the actual part of the photonpackage that survives and continues in the photon package’s life cycle. As before, this

29

Page 32: TineGeldof_Thesis fysica

calculation will still be performed for every wavelength. Thus, a small loop rangingover the minimal and maximal wavelength of every photon package is inserted in thefunction. At this stage of the simulation only single dust components are treated, asmultiple dust components will be too complicated.

Simulating the propagation through the dust

If the total luminosity Ltot of the photon package after the continuous absorption dropsbelow a certain minimum value, its life cycle is ended and this luminosity packagewon’t be taken into account anymore. When in contrary it doesn’t reach the critical lu-minosity value, the scattered part of the photon package will subsequently propagatetrough the dusty medium due to the simulatepropagation function. This functionwill determine the next scattering location of a photon package, as explained in section1.2.1, and then simulate the propagation to this position. Here, the problem mentionedin section 1.3.3 arises, as a random interaction optical depth must be sampled from thePDF given in function 1.10, which only will be done at the reference wavelength.All luminosities Lλ of the photon package will in this case have to propagate to a ran-dom interaction point, determined by the value of the optical depth of the photonspath τre f ,path at the reference wavelength. This is only correct for the luminosity at thereference wavelength Lλre f . To compensate for this miscalculation, the intensity of theray at different wavelengths at the point of interaction should be multiplied with theprevious explained biasing factors wλ. Recall eq. 1.12 for this factors:

wλ = eτre f−τλ

[τλ

τre f

] [1− e−τre f ,path

1− e−τλ,path

]

This method is schematically displayed with a simplistic model in figure 2.2.

The biasing factors in equation 1.12 can be calculated in three steps. First, the opticaldepth of the photons path τre f ,path is retrieved from the DustSystemPath object. Thisis only done at the reference wavelength λre f , such that the random optical depth τre f

can be drawn in the range [0, τre f ,path].A following step is to create a loop over all wavelengths of interest of the package,ranging from the minimum wavelength index to the maximum index. In this loop,τλ,path is extracted as done before. The only difference for the wavelengths other thanthe reference wavelength is that τλ won’t be drawn randomly. When looking at eq. 1.4for an arbitrary wavelength, it is possible to divide this by the same equation for the

30

Page 33: TineGeldof_Thesis fysica

Lλ1 ... Lλre f ... LλN

λ1 ... λre f ... λN

? ? ?×wλ1 ×wλre f = 1 ×wλN

L′λ1... L′λre f ... L′λN

Figure 2.2: Demonstration of the method of compensation by use of biasing factors. Thesefactors are wavelength dependent and must be calculated using eq. 1.12. Note that at thereference wavelength the weight factor equals unity.

reference wavelength to get:

τλ

τre f=

∫ s0 κλρ(s′)ds′∫ s

0 κre f ρ(s′)ds′=

κλ

κre f.

This can also be done for τλ,path and τre f ,path, which contain the same integral but withthe path length s going to infinity. This gives the same result as in the right hand side ofthe above equation. The optical depth τλ can thus be estimated using the fact that

τλ

τre f=

τλ,path

τre f ,path.

Here, it is clear that multiple dust components will result in too complicated calcula-tions, as the different mass densities should be added. Eventually we can calculate thebiasing factors wλ for every wavelength, using the optical depths calculated before andusing eq. 1.12.

Simulating peel-off photon packages

After the propagation of the photon package to a certain point in the system, peel-off photon packages are created by the peeloffscattering function. This is also oneof the optimization techniques discussed in section 1.2.2, where figure 1.2 shows theworking of this method. Mark that this function is called just before a scattering eventis simulated.In this calculation, a peel-off photon package will be created for every instrument inthe instrument system and will be forced to propagate in the direction of the observers.This peel-off package will also contain a list of luminosities, from which every wave-length dependent luminosity Lλ will be detected independently. To compensate for

31

Page 34: TineGeldof_Thesis fysica

the change in propagation direction, Lλ must be altered by multiplying it with an ad-ditional weight factor given by eq. 1.11. This factor, which represents the probabilitythat a photon package would be scattered in the direction kobs if its original propaga-tion direction was k, is wavelength dependent. Because of this, the detection of thepolychromatic peel-off photon packages will still be performed for every wavelengthindependently, such as in the monochromatic case.

Simulating the scattering event

As a final aspect of the photon package’s life cycle, it will undergo scattering by thedust grains. This procedure is accomplished by the simulatescattering function,which of course increases the number of scattering events experienced by the photonpackage by one. Secondly, the function will generate a new random propagation di-rection, which will be sampled from the scattering phase function Φs(θ, λre f ), remem-bering that only one dust component is assumed. As the new propagation directionis drawn at the reference wavelength, biasing factors must be calculated for the otherwavelengths. Recall the formula for this factors, given in eq. 1.13:

wλ =Φs(θ, λ)

Φs(θ, λre f )

The concept of this weight factors is just as before, i.e. the intensity of the ray at thedifferent wavelengths must be multiplied with the computed values of the biasing fac-tors in a way demonstrated in figure 2.2.When the photon finishes this last process, it has completed one cycle of his life. Subse-quently, it will start a following cycle by filling the newly generated path of the photonpackage with dust. All the previous processes will be run again, until the packagereaches a total luminosity Ltot lower than Lmin. When this is the case, the photon pack-age dies and the life cycle is terminated.

32

Page 35: TineGeldof_Thesis fysica

2.4 Thermal dust emission

In the preceding sections the thermal emission by the dust grains has not been consid-ered. Only a simple adaptation in the ski file must be made to take this feature intoaccount. As explained in section 2.1, the rundustemission function will be responsiblefor this feature.Before the life cycle of the photon packages can be started, the total luminosity thatis emitted from every dust cell must be determined. Originally, for a monochromaticphoton package at wavelength λ and a dust cell m this is just the product of the to-tal luminosity absorbed in that cell, Labs

m , and the normalized SED at the particularwavelength λ corresponding to that cell, as obtained from the dust emission library.The same will be done in the adjusted program, such that only a loop over the wave-lengths should be implemented to construct the luminosity vector of the polychromaticphotons, determined by Labs

m and the normalized dust SED at every wavelength cor-responding to cell m. The reference wavelength will this time be set somewhere be-tween the IR and submm range, as thermal dust emission predominantly covers thatwavelength range. It will be determined by the center of the wavelengths the emittedphotons cover.

A vector Xtot is created that describes the normalized cumulative total luminosity dis-tribution, containing the following components:

Xtot,m =m

∑m′=0

Ltot,m′

Ltot(2.1)

This vector is used to generate random dust cells from which photon packages canbe launched. The dust emission can start afterwards by launching Npp polychromaticphoton packages. The original positions of this photons will be chosen as a randomposition in the dust cell m, in his turn chosen randomly from the cumulative luminos-ity distribution Xtot.As the reddened photon packages are emitted, their life cycle trough the dust can be-gin, just as explained in section 2.3, by making use of the five specific functions: fill-DustSystemPath, simulateescapeandabsorption, simulatepropagation, peeloffscat-tering and simulatescattering. Note that no further adaptations must me made inthese functions.

33

Page 36: TineGeldof_Thesis fysica

2.5 The dust self-absorption

The reddened photon packages, which are created by thermal dust emission after theywhere absorbed, can undergo a similar process by the rest of the dusty medium. Thisprocess is called dust self-absorption and is a method to calculate the internal equilib-rium temperature of the dust. As the thermal emission of dust ranges over the infraredand sub-millimeter spectrum, it should be these wavelengths which are re-absorbed,however interstellar dust is somewhat less efficient in absorbing at these ranges.The relevance of the dust self-absorption process can depend on two aspects: the op-tical depth of the system and the temperature of the dust. If the system contains amodest amount of dust, having a low optical depth throughout the medium, it will betransparent to long-wavelength radiation. When the system contains a considerableamount of dust, making it opaque, this process will become important as mid- andfar-infrared radiation will be more likely to be absorbed. Secondly, the dust tempera-ture affects the likelihood of absorption as well. An increasing temperature of the dustcan shift the dust SED peak to shorter wavelengths, causing it to enter the NIR andoptical ranges. Dust is more efficient in absorbing these wavelengths, making the dustself-absorption process more important in these cases.

The dust self-absorption function consist of an outer loop which in a continuous man-ner absorbs and re-emits the radiation several times. This outer loop, and hence alsothe function itself, terminates when either the maximum number of dust self-absorptioniterations has been reached, which is set to a value of 100, or when the total luminosityabsorbed by the dust is stable, i.e. when it does not change by more than 1% comparedto the previous cycle.Before the life cycle of the emitted polychromatic photon packages is started, a similarprocess as in section 2.4 must be considered. This is determining the total luminosityLtot,m absorbed in every dust cell, that hence will be emitted. Again a normalized cu-mulative total luminosity distribution as in eq. 2.1 is created, used to determine therandom generated dust cells from which the photons will be emitted.When the life cycle within this process starts, the peel-off technique (i.e. the functionpeeloffscattering) should not be considered, as the dust self-absorption phase is atechnique for computing the internal equilibrium of the dust grains. As the emergentradiation field doesn’t have to be estimated, the life cycle of a photon package withinthis phase is somewhat more simplistic than before.When this function is terminated, the function explained in section 2.4 which calcu-lates the last emission of the dust and afterwards estimates the radiation emerging inthe direction of the instruments is called.

34

Page 37: TineGeldof_Thesis fysica

2.6 Overview

In the preceding sections the different stages within the panchromatic simulation inSKIRT were explained in detail. We described all the adaptations in the code that werenecessary to implement the polychromatic algorithm. These implementations weredone in different classes, from which the most important ones were the PhotonPackageclass, the MonteCarloSimulation class and the PanMonteCarloSimulation class. Notethat the necessary adjustments in sub- or super classes commonly used in both thepanchromatic and oligochromatic simulation of SKIRT will not work for the latter.The most difficult part was the implementation of the biasing factors (eq. 1.12 and1.13) that were needed to compensate for the incorrect sampling of the interaction op-tical depth and scattering angle at wavelengths other than the reference wavelength.This was explained in section 2.3.

It is now possible to investigate the results obtained by the polychromatic algorithm.This will be done in the next chapter by comparing the original SKIRT code with theadapted one and verifying their similarities and differences. The out coming resultswill mostly be tested for accuracy.

35

Page 38: TineGeldof_Thesis fysica

36

Page 39: TineGeldof_Thesis fysica

Findings 33.1 Stellar model without dust: bi-Plummer model

For investigating the first step of the implementation, it is recommended to choose avery simplistic galaxy model. Here, a spherical stellar model is used, called a Plummergalaxy, which in a relatively good way can represent elliptical galaxies. We create sucha simple ski file consisting of two unequal Plummer model stellar systems, each con-taining a black body spectral energy distribution (SED). The first Plummer model hasa black body temperature of 104 K, while the other galaxy is one order colder, havinga temperature of 103 K. The peak of the spectrum of the latter will hence be visible atlonger wavelengths than the first. For running the simulation, 107 photon packagesare launched within the wavelength range of 0.1− 10 µm, divided into 21 wavelengthgrid points. The more wavelength bins are used to calculate the stellar emission, themore accurate the results will be. Only wavelengths within the optical range are takeninto account, since there is no emission of the dust grains nor a dust system present inthis model.

This simple ski model, without any dust components, is an ideal way to check thevalidity of the implementation of the launch function, i.e. the function that creates thephoton packages. As no dusty medium is present, the photon packages won’t undergoany interaction when propagating towards the observers. They will only be emitted bythe stellar systems, where-after the peel-off technique is used to estimate the radiationwhich emerge in the directions of the detectors. For now, the setting of the referencewavelength won’t be of importance, as this value is not used in the launch function orthe peeloffemission function. On the other hand, this will become significant when-ever a dust system is present in the model.

When looking at the SED files, we can distinguish five different fluxes spanning overmultiple wavelength bands.

• Total flux: the total flux detected by the instruments. It contains the direct, scat-

Page 40: TineGeldof_Thesis fysica

tered and dust flux.

• Direct flux: the flux resulting from the stellar photon packages which directlyreach the instruments.

• Scattered flux: the flux resulting from stellar photon packages that where scat-tered by the dust before they reached the instruments. As no dust is included inthis model, this flux component will be zero.

• Dust flux: the flux resulting from photon packages that were emitted by the dust.As no dust is included in this model, this flux component will be zero as well.

• Transparent flux: flux that would be detected by the instruments if there were nodust in the system. In this model, the transparent flux will be equal to the directflux.

In figure 3.1 the total fluxes of the original and adjusted SKIRT codes are compared toeach other by plotting their SEDs on one graph. You can clearly distinguish the stellaremission of both Plummer models, as they result in two separated black body curves.The hottest stellar object is visible at shorter wavelengths, between 0.1 µm and 1 µm,while the coldest is visible at the longer wavelengths, between 1 µm and 10 µm. Itis clear that both curves, showing the fluxes of the monochromatic and polychromaticemitted photons, coincide very well, with an almost negligible relative difference rang-ing over 0.016%. As a reference, a dashed line indicating the zero percent is drawnon the graph. One can say that both simulations are in good agreement, hence theemission of the polychromatic photon packages from the stellar objects are performedcorrectly within the adapted panchromatic simulation.

38

Page 41: TineGeldof_Thesis fysica

Figure 3.1: Top: Comparison of the SED plots for the total flux of the monochromatic (red line)and polychromatic photon packages (green line). Mark that the green curve is covered by thered curve because they coincide almost exactly. Bottom: The difference plot of the total fluxesfor the monochromatic and polychromatic photon packages. The differences are expressed inpercents.

39

Page 42: TineGeldof_Thesis fysica

3.2 Stellar model with dust component

The main purpose of the SKIRT program is of course studying how the dust affects thesimulated galaxies, consisting of emission sources and a dusty medium. Two differentimportant phenomena, i.e. the absorption and the scattering process, of the simulationcan be tested to investigate these dust effects. In order to test these two processes, a skifile is created consisting of a stellar object with an exponential disk geometry, contain-ing a disk of dust in the system with an exponential geometry. Note that only one dustmixture should be inserted in the model, as the panchromatic calculations for the poly-chromatic photons would otherwise be too complicated. The default value is used toinitiate the dust type, this is an average dust mixture that is appropriate for the typicalinterstellar dust medium. The stellar SED type used for this system is extracted fromthe Pegase library. A total amount of 106 photon packages are launched which coverthe spectrum over a wavelength range of 0.1− 10 µm. This range is divided into 61wavelength grid points.Two detection instruments are set in this model to estimate the radiation it transmits:one instruments looks at the system edge-on, having an inclination of 90 degrees, theother looking at the spiral galaxy face-on, having a zero inclination. As discussed insection 1.1, the edge-on view of the spiral model will be affected the most by the dust,as this dust is located predominantly in the disk of the galaxy. This will also be illus-trated in the results given in the following sections.

While testing the adaptations discussed in section 2.3, we can again check the correctlaunching of the photon packages within this somewhat more difficult model. Thiswill be done in section 3.2.1 by looking at the transparent fluxes in the SEDs of thesimulations, hence the fluxes that result from the stellar photon packages without anydust interaction. Afterwards, when the results of the polychromatic launching func-tion is in good agreement with what it should be, the absorption by the dust can bechecked. This will be done in section 3.2.2 by examining the direct fluxes in the SEDsof both simulations. These direct fluxes represent the emergent radiation (the stellaremission) of the object, influenced by the absorption by the dust grains. Scattering ofthe photon packages is not considered in this part, as this will be a third and final stepfor testing the implementations. Inspecting the dust scattering will be done by lookingat the scattered fluxes in the SEDs. This is the most tricky part, as biasing is an impor-tant factor in this stage of the simulation. Section 3.2.3 will show the testing results forthis part.

40

Page 43: TineGeldof_Thesis fysica

3.2.1 Launching of the photon packagesThe transparent fluxes of both simulations are given in the SED in figure 3.2. ThisSED of the spiral model is calculated for a detection instrument looking at the systemat an inclination of 90 degrees. The investigated transparent fluxes correspond to thefluxes of the simulation without considering the dust interaction. They are hence per-fect for estimating the correct performance of the stellar emission in the simulation ofthis model. As demonstrated in section 3.1 for the bi-Plummer model, we expect againthat the monochromatic and polychromatic photon simulations show approximatelythe same results, as is confirmed by figure 3.2. The relative difference, displayed inthe graph below the SED, even returns values equal to zero percent. This seems some-what strange at first, but we have to mark the fact that the fluxes are stored as datahaving a maximum number of 8 digits after the decimal point. The transparent fluxesof the simulations hence will have such small errors that are not visible in the data.We can conclude that the panchromatic simulation of this edge-on spiral model us-ing polychromatic photon packages does indeed reproduce the same results as whenmonochromatic photon packages are used.

Figure 3.2: Top: Comparison of the SED plots for the transparent flux of the monochromatic(red line) and polychromatic photons (green line). The green curve is covered by the red curvebecause they coincide almost exactly. Bottom: The difference plot of the transparent fluxes ofboth simulations. The differences are expressed in percents.

41

Page 44: TineGeldof_Thesis fysica

3.2.2 Absorption of the photon packages

When examining the direct fluxes of the simulations, we can investigate if the dustaffects the stellar photon packages by absorption in the correct manner. The directflux Fdir represents the radiation received by the detectors, which propagated throughthe dust without being scattered. Figure 3.3 reflects the SED of the edge-on spiralgalaxy for both simulations. Again, the red curve corresponds to the simulation usingmonochromatic photon packages and the green curve to the simulation using poly-chromatic photon packages. Both coincide very well, having a relative difference be-tween −0.3% and +0.1%. This is still a more than adequate result, as the original sim-ulation itself consists of errors resulting from the random seeds generated for everyprocessor. The internal differences of the code is called noise.

Figure 3.3: Top: Comparison of the SED plots for the direct flux of the monochromatic (red line)and polychromatic photons (green line). The green curve is covered by the red curve becausethey coincide almost exactly. Bottom: The difference plot of the direct fluxes of both simulations.The differences are expressed in percents.

42

Page 45: TineGeldof_Thesis fysica

This so called noise of the Fdir resulting from the monochromatic photon packages, de-tected by the instrument at an inclination of 90, is shown in figure 3.4 for a wavelengthrange covering 0.4− 3 µm, corresponding to the peak of the SED. To obtain this figure,the simulation is run 10 times, containing 105 monochromatic photon packages. Thenoise seems to cover a range of 2% (±1%). The black line in the figure represents themean noise x of the simulations, calculated for every wavelength and having standarddeviations 1σλ indicated by the error bars. The standard deviation at every wavelengthis calculated as follows:

σλ =

√√√√ 1N − 1

N

∑i=1

(xi,λ − xλ)2 (3.1)

Reducing the noise in these simulations can be done by increasing the amount ofmonochromatic photon packages. When using for example 108 monochromatic pho-ton packages, the noise can be reduced to almost zero.The same can be done for estimating the noise produced by the polychromatic photonpackages in the simulation, displayed in figure 3.5. The relative difference for everysimulation, containing 105 polychromatic photon packages, is calculated with respectto a reference simulation containing 108 monochromatic photon packages. As before,the black curve represents the mean noise and the error bars indicate the standard de-viation calculated by eq. 3.1. As you can see in figure 3.5, the simulations provide anerror ranging over 1.5%, which is approximately equivalent with the noise producedby the original simulation in figure 3.4. It is of great importance that the relative dif-ferences between the original and adapted simulations are always compared to thisnoise, to obtain an estimation of how accurate both results are. You may have noticedthat the noise produced by the adapted SKIRT code in figure 3.5 is not so random aswe expect it to be. Instead, continues curves corresponding to each simulation with adifferent random seed are produced. This is however not so peculiar, as every wave-length dependent flux Fλ is influenced by the biasing factors used in the SKIRT code.The magnitudes of this weight factors will form a continue curve in function of thewavelength, crossing unity for the reference wavelength.

Using the ds9 software, it is possible to visualize this spiral galaxy in a two-dimensionalimage, as it would look like in the plane of the sky. To obtain a nicer and more realisticimage, a bulge is added to the model. The spiral galaxy is now composed of a disk,having an exponential disk geometry, and a bulge, which has a Sersic Geometry. Cal-culating the image composed of the direct flux Fdir only, a result as given in the bottomof figure 3.6 for the simulation that uses polychromatic photon packages is obtained.The spiral galaxy is viewed from an inclination of 88. The different colors indicatethe magnitude of Fdir, indicated by the color bar below. We can clearly observe the

43

Page 46: TineGeldof_Thesis fysica

structure of the edge-on spiral system, due to the emission by the bulge and the disk ofthe stellar object. A clear dust lane is visible in the image, which is caused by the dustextinction in the disk of the galaxy. As the differences are to low to visualize, it is notpossible to distinct the obtained result with the image of the original simulation thatuses monochromatic photon packages, displayed in the top of figure 3.6. To make thispercentage difference clear, a residual frame of the two simulations has to be made,shown in figure 3.7.

Figure 3.4: The noise resulting from the direct fluxes Fdir of the panchromatic simulation usingmonochromatic photon packages. The error bars indicate 1σ deviations. The simulation is run10 times, having different random seeds set in the ski-files and run over 20 threads.

Figure 3.5: The noise resulting from the direct fluxes Fdir of the panchromatic simulation usingpolychromatic photon packages. The error bars indicate 1σ deviations. The simulation is run10 times, having different random seeds set in the ski-files and run over 20 threads.

44

Page 47: TineGeldof_Thesis fysica

Figure 3.6: V-band images of the edge-on spiral galaxy produced by the panchromatic simula-tion with the original code using 108 monochromatic photons (top) and the adapted code using106 polychromatic photons (bottom). These images are the results of the direct fluxes Fdir only.

This residual frame is calculated as:

FrameRes =|FrameRe f − Framesim|

|FrameRe f |(3.2)

The frame obtained by the original simulation using 108 monochromatic photon pack-ages is set as a reference frame Framere f . Hence, the pixels in the residual frame areobtained out of the difference between the pixel values of the two frames, divided bythe pixel values of the reference frame. The color bars represent errors in 12.5 % levels.All white pixels have an error of more than 87.5%, which may exceed 100%. Noticethat the outer edges of the edge-on spiral galaxy have the highest errors, due to thedetection of very small fluxes in these pixels. A pixels can for example detect only onephoton in one frame, arrived at that particular location by the various random pro-cesses, while detecting none in the other frame. These errors at the edges can probablybe reduces by using more photon packages in both simulations. The disk has errorsranging up to 37.5%. Another aspect that can be seen is for longer wavelengths (bot-tom of the figure), where the disk contains more pixels with errors below the 12.5%.On the other hand, a shorter wavelength (top of the figure) shows the pattern of a dustlane within the disk, producing higher errors. This is the result of the high efficiencyof extinction at these wavelengths.

45

Page 48: TineGeldof_Thesis fysica

Figure 3.7: The residual frames of the V-band images resulting from the simulation using 106

polychromatic photon packages and the reference V-band image. From the top image to thebottom the wavelength is increased from a short to longer wavelength bin. The middle framerepresents the residual frame in the center of the optical range (around 0.55 µm). The colorbar shows percentage differences in levels of 12.5%, ranging from 0% (black) to 100% or more(white).

46

Page 49: TineGeldof_Thesis fysica

3.2.3 Scattering of the photon packages

Extinction of the photon packages by the dust does not only result from the physicalprocess of absorption, but from scattering as well. Here we want to check whetherthis scattering process is performed correctly and discover how hard the use of biasingfactors affects the out coming results. The photons that will be scattered by the dust,located predominantly in the disk of the galaxy, will most likely be detected by the face-on instrument systems, i.e. the detectors that look at the galaxy from a zero inclinationangle. This is due to the absorption in the disc, that prevents photons from beingdetected in the edge-on view. This is why the results in this section will always beexamined for the face-on spiral galaxy. The scattered fluxes Fsca detected by the face-oninstruments of both simulations are displayed in figure 3.8 and seem to coincide verywell. Notice that we have restricted the range of the scattered flux values of the SEDto 4 orders of magnitude. Looking at the relative difference plot, the error seems to bevery low for short wavelengths, i.e. for wavelengths below 7 µm the relative differencelies between the −2% and +2%. The red part of the SED spectrum gives a result withhigher differences, which is not shown in the figure, ranging to approximately −16%.These wavelengths however contain scattered fluxes having magnitude orders as lowas 10−13, for which very small errors can result in very high percentage differences. Itis therefor only useful to look at the highest fluxes of the SEDs, ranging over 4 ordersof magnitude.

We can again examine the noise resulting from the adapted simulation for the scatteredfluxes, detected by the face-on instrument, as this is important to estimate the accuracyand correctness of the new SKIRT code. The percentage difference of every simulation,containing a different random seed initiated in the ski-file, is calculated with respect toa simulation containing 108 monochromatic photon packages, as this simulation pro-duces a noise equal to zero due to its high precision. The results are displayed in figure3.9. The noise covers a range of 2% (± 1%) within 1σ for wavelengths shorter than1 µm, while it increases for longer wavelengths. We know that using a larger amountof monochromatic photon packages in the original SKIRT code can reduce the noiseand increase the accuracy in the simulation as much as possible. This will be the casein the adapted SKIRT code as well, however it will not fulfill, as the biasing factorswλ that induce these large errors depend on parameters of the dust system, i.e. thetotal dust mass. A possibility to reduce this noise is the use of partly polychromatic pho-ton packages, i.e. to split the photon package into multiple photons containing smallerwavelength ranges. This concept of photon splitting should reduce the biasing factorswhich are used in the simulatepropagation function. It will be explained in moredetail in section 3.4.

47

Page 50: TineGeldof_Thesis fysica

Figure 3.8: Up: Comparison of the SED plots for the scattered flux Fsca of the monochromatic(red line) and polychromatic photon packages (green line). The green curve is covered by the redcurve because they coincide almost exactly. Down: The difference plot of the scattered fluxes ofboth simulations. The differences are expressed in percents.

Figure 3.9: The noise for the scattered flux produced by the panchromatic simulation using 105

polychromatic photon packages. For the calculations, the simulation is run 10 times, havingdifferent random seeds set in the ski-files and run over 20 threads.

48

Page 51: TineGeldof_Thesis fysica

Figure 3.10: V-band images of the edge-on spiral galaxy produced by the scattered photons,simulated with the original code (top) and the adapted code (bottom).

Using ds9, we can obtain the two-dimensional V-band images of the scattered flux Fsca

produced by the galaxy. As in the previous section, the model that contains only an ex-ponential disk is improved to a more realistic case by adding a Sersic bulge to the stel-lar geometry. The obtained results are displayed in figure 3.10 for both panchromaticsimulations, viewed from an inclination of 88. Comparing the V-band image resultingfrom the original monochromatic SKIRT code with the V-band image resulting from theadapted polychromatic SKIRT code will, just as before, be done by creating a residualframe using eq. 3.2. This frame is shown in figure 3.11, where the color bar rangesfrom 0% to 100%. The white pixels can in this case contain percentage differences thatexceed the 100%. It is clear that the edge of the spiral galaxy has errors higher than87.5%, caused by the very low or even zero detected scattered fluxes in these pixels.The center of the disk contains pixels with errors below 12.5% for longer wavelengths(bottom of the figure), while these pixels have higher errors at shorter wavelengths(top of the figure), due to the high extinction rate in this wavelength band.

49

Page 52: TineGeldof_Thesis fysica

Figure 3.11: The residual of the V-band image resulting from the simulation using 106 polychro-matic photon packages and the reference V-band image. From the top image to the bottom thewavelength is increased from a short to longer wavelength bin. The middle frame representsthe residual frame in the center of the optical range (around 0.55 µm). The color bar representspercentage differences in levels of 12.5%, ranging from 0% (black) to 100% or more (white).

50

Page 53: TineGeldof_Thesis fysica

3.3 Optically thin and thick models

In the previous section we found that the scattered flux Fsca of the spiral model for themonochromatic and polychromatic algorithm were in relative good agreement. Thecalculated difference in the SED between both methods where low enough to be ableto conclude that the polychromatic algorithm works properly. However, we only con-sidered a particular model that contains a dust mass of 4 × 107M. As the opticaldepth τλ is given by

τλ =∫

κλρds = κλΣ ,

with Σ the mass integral along the photon’s path and κλ the extinction coefficient, τλ

can obtain large values when the dust mass is increased, making the model opticallythick (τλ >> 1). This will have a dramatic effect on the values of the biasing factorswλ. Recall eq. 1.12:

wλ = eτre f−τλ

[τλ

τre f

] [1− e−τre f ,path

1− e−τλ,path

]

= eΣ.(κre f−κλ)

[κλ

κre f

] [1− e−τre f ,path

1− e−τλ,path

]

You can see that the weight factor wλ grows exponentially with the mass integral Σ.Increasing the dust mass in the spiral galaxy, i.e. changing the optically thin systemto an optically thick system, can have as a consequence that the biasing factors raiseto extremely high values. In the model used in the preceding sections, the magnitudeof wλ even exceeds a value of 2800 at a wavelength of 6.30 µm, this is of course un-acceptable when we want to obtain accurate results. These high weight factors willhave a tremendous effect on the detected scattered flux of the system, especially in theface-on configuration. An example of this effect is shown in figure 3.12 for Near IRwavelengths, where the frames on the left obtained by the reference monochromaticsimulations are compared to the frames on the right, resulting from the polychromaticalgorithm. From top to bottom you can see the results from systems having opticaldepths τλ equal to 0.1, 1, 10 and 100, specified at a wavelength of 6.30 µm. One canclearly observe that the images are affected by the large biasing factors when the opti-cal depth τλ of the system is increased, as the frames become very noisy. Some pixelsseem to detect flux densities that have been boosted to very high values, shown by theyellow and red pixels divided over the exponential disk. Notice the low fluxes Fsca forτλ = 0.1, as the optically thin system causes little scattering. At τλ = 100, it seems thatFsca are smaller as well. This is due to the high amount of photon absorption, by

51

Page 54: TineGeldof_Thesis fysica

Figure 3.12: Images in the Near IR of the face-on spiral galaxy. The left frames are obtained bythe monochromatic algorithm, the right by the polychromatic algorithm. From top to bottomthe optical depths τλ are increased from 0.1 to 100. Notice the high noise for the optically thicksystems, originating from the extremely high biasing factors by which the luminosities at thesewavelengths are altered.

52

Page 55: TineGeldof_Thesis fysica

which little scattered photons can reach the detectors.The table below illustrates how enormous the weight factors can become for the opticaldepths used in the above simulations. Notice that in the τλ = 100 case, the highestencountered weight factor is too big to be stored as a double-value in the code.

τλ wλ,max

0.1 16.23381 6.22089 ×1016

10 1.44838 ×10173

100 inf

The effect that these magnitudes of the optical depth τλ have on the accuracy of themodel can be seen in figure 3.13, where the relative differences between the scatteredflux densities produced by the monochromatic and polychromatic photons are cal-culated for four different τλ-values and two different inclination angles. From thesegraphs we can see that for small optical depths the results agree very well. Noticethat for τλ 6 0.1 a ’tail’ appears at wavelengths longer than 6 µm having higher dis-crepancies. This is due to the very small magnitudes of the scattered flux Fsca at thesewavelengths, as scattering is very inefficient in the Far IR range. For larger opticaldepths, i.e. τλ > 10, higher discrepancies become visible. For the τλ = 100 case,these relative differences can increase to more than 50%. In other words, when theoptical depth increases, the calculations made with polychromatic photon packagesbecome increasingly affected by the large range of optical depths encountered at dif-ferent wavelengths. The used reference wavelength lies in the center of the opticalrange, around 0.55 µm, where the extinction coefficient and thus the opacity is veryhigh. The accuracy suffers the most at longer wavelengths, starting at about 2 µm,because the extinction coefficient drops to a much lower value there. This causes theextinction processes to be less efficient at these longer wavelengths, which results in alower opacity.

53

Page 56: TineGeldof_Thesis fysica

Figure 3.13: Difference in SED of the scattered flux between the results obtained with 106

monochromatic photon packages and 106 polychromatic photon packages. The models sim-ulated are optically thin (top left) to optically thick (bottom right). In the most optically thickcases the results obtain discrepancies that can increase to 50%.

As has already been pointed out in the previous section, a possible solution to avoidthis drawback is the use of partly polychromatic photon packages. The photon will be splitone or more times, allowing the red photon package, i.e. the photon that contains arange of longer wavelengths, to possess a higher reference wavelength as a character-istic. The extinction coefficients at these longer wavelengths will have a value closer toκre f ,red, causing the biasing factors wλ to remain within particular bounds. This tech-nique, as will be explained in the following section, will make it possible to limit themagnitude of the biasing factors.

54

Page 57: TineGeldof_Thesis fysica

3.4 Splitting of the photon packages

3.4.1 The concept of photon splitting

The polychromatic algorithm has been tested for some basic stellar and dusty mod-els, showing that it does indeed reproduce approximately the same results as obtainedwith the monochromatic simulation. In very optically thick models (having opacitiesτλ >> 1), extremely large weighting factors can occur as eq. 1.12 can increase withoutbound. This suggest that a proper choice of a reference wavelength is indeed crucialfor the accuracy of the method.

The disadvantages resulting from the large weighting factors can probably be allevi-ated by splitting the photon packages in multiple parts. In this way, partly polychromaticphoton packages are created, which contain a range of wavelengths with a certain refer-ence wavelength, but not the whole electromagnetic spectrum. The mechanism shouldbe implemented in such a way that a particular photon package continues splitting,until it contains a range of weighting factors close enough to unity. This mechanismis represented in a simplistic manner in figure 3.14, where an original photon is splitinto a blue and a red photon. The splitting happens at the index of the reference wave-length. The red photons, i.e. the photons containing the wavelength range above thereference wavelength, will consecutively be stored in a deque, while the blue photonswill continue there calculations.

From equation 1.12, it can be seen that the weight factors grow exponentially with themagnitude of the random interaction optical depth τλ. In other words, the larger therandom propagation path s of the photon package is, the higher the biasing factors at

λ1... λref

... λN

Original photon

@@@@RBlue photon Red photon

λ1 ...λref,blue... λref λref+1 ...λref,red... λN

@@@@R

Blue-blue photon Blue-red photon

Figure 3.14: Demonstration of the splitting of a photon package into a blue and a red part. Thesimulation will continue with the blue photon package and split this further if necessary.

55

Page 58: TineGeldof_Thesis fysica

certain wavelengths will be. Due to this, the implementation of the photon splittingshould be within the fillDustSystemPath function, such that the photon is split be-fore the random interaction point is drawn. In the opposite case, when the randomscattering location is determined before the photon is split, every photon that wouldpropagate to and interact close to the edge of the medium, where large interaction op-tical depths are found, will be forced to interact deeper in the medium, where smallerinteraction optical depths are found. This is of course undesirable if we want to obtainaccurate results.In the function fillDustSystemPath, a flag ynsplit is defined, initially set as false,indicating whether the photon package has been split or not. As follows, a routinethat calculates the biasing factors at the end of the photon’s path wλ,path begins. Thisis done by using τλ = τλ,path and τre f = τre f ,path in equation 1.12, hence calculatingq(τλ,path)/q(τre f ,path). Whenever one of the weight factors wλ,path reaches a value thatdeviates to much from unity, the photon will be split. This deviation limit has to be de-termined experimentally, which will be done in section 3.4.2. A red package is created,having all the characteristics of the original photon package except for the minimumand maximum wavelength indexes, and stored at the end of the deque. In the origi-nal package, now referred to as the blue photon package, a new reference wavelength(set as the center of the photon’s wavelength range) and maximum wavelength index(above which the luminosities are set to zero) are indicated. The ynsplit boolean is settrue such that the calculation can start over.This process will continue, every time performed with the blue part of the packagethat has been split, until the range of biasing factors for that particular blue photon iswithin the selected limits. The routine described in section 2.3 now continues by call-ing the different functions that describe the blue photon package’s life cycle.Every partly polychromatic photon that is stored in the deque will consecutively un-dergo the life cycle described in section 2.3, before a new polychromatic photon pack-age can be launched. Notice that a small adjustment must be made in order to termi-nate the photon’s life cycle. At the moment, a photon dies when its total luminositydecreases below a minimum value, determined by the total luminosity of the systemLtot and the amount of photon packages in the simulation by the relationship:

Lmin = 10−4 × Ltot

Npp. (3.3)

When a photon is split into multiple parts, the different photon-parts will cover smallerwavelength ranges and thus will contain smaller total luminosities. This can induce aproblem, as the split photons will probably terminate their life cycles too soon, basedon the minimum luminosity in eq. 3.3. To solve this problem, Lmin is redefined by

56

Page 59: TineGeldof_Thesis fysica

using the largest luminosity Lλ,max that a photon package, which is taken from thedeque, contains:

Lmin = 10−4 × Lλ,max . (3.4)

This maximal luminosity is extracted from the photon by implementing a small func-tion maxluminosity in the PhotonPackage class. Whenever the maximal luminosity aphoton contains drops below this critical value 3.4, its life cycle is terminated.

3.4.2 Determination of the optimal biasing limit

Determining at which value of wλ,path a photon package should exactly split shouldbe determined experimentally. In this project we do not try to increase only the accu-racy of the simulations, but the speed as well. Our purpose now is to find an optimalbalance between these two benefits of (partly) polychromatic photon packages. As thebasing factor wre f ,path at the reference wavelength equals to one, we speak of a devia-tion from unity, determined by |wλ,path − 1|. In the case the maximal deviation, whichwe will now refer to as bdev, is extremely small, the simulation that uses partly poly-chromatic photons will reduce to the simulation using monochromatic photons. In thiscase, the biasing factors will all equal unity and hence the accuracy is optimized. Ofcourse, when a lot of the photon package splitting occurs, the simulation time will un-necessarily increase. On the other hand, when bdev is extremely large, the simulationreduces to the polychromatic case where the splitting technique is not used. In thiscase the accuracy will be lower, but the simulation will speed up. Note that for thespiral model that is used in the previous sections, wλ,path can gain values up to 2000,although they are not very common.

Amount of photon splitting

To get a picture of the amount of photon splitting occurring in a simulation which usesa particular value of bdev, we can plot the splitting percentage, given by

Nsplit

Npp× 100% ,

in function of these bdev-values. For this, a counter is added in the code to keep atrack of the amount of splitting Nsplit happening. Recall from the previous section thatone photon can split multiple times, by which the splitting percentage can exceed the100%. In the spiral model used in this project, the wavelength range is divided into61 bins, causing the maximal possible value of the splitting percentage to be 6000%,as each photon package can split 60 times. Some arbitrary values of bdev are chosen,

57

Page 60: TineGeldof_Thesis fysica

given in Table 3.1, for which every simulation is run 10 times with a different randomseed set in the ski-file. Mark that the simulations are done using only one thread.Otherwise, due to the parallelization in SKIRT, a photon that is stored in the dequecan be extracted and calculated multiple times. The amount of split photons for eachsimulation corresponding to every bdev-value are shown in the table, together withtheir calculated average and standard deviation. This result is graphically shown infigure 3.15, where you can see the average splitting values in function of bdev. Theerror bars are too small to be visible and indicate the 1σ uncertainty given in the table.As expected, we obtain a declining curve, i.e. more photons are split when a strict (low)limit is used compared to a more lax limit. When choosing a low deviation limit bdev,the simulation time would increase, which is of course undesirable. This means that ahigh value of bdev, causing little or no photon splitting, is preferred to get an optimalspeed. However, the reason this technique was introduced was in order to obtain moreaccurate results. As we will see in the next section, this means that a lower value of bdev

is needed. We can already conclude that the most important value for the limit of thebiasing factor will be found between the values bdev = 0.1 and 10. For bdev higher than10 the photon splitting becomes negligible, while for bdev lower than 0.1 the amountof photon splitting becomes incredible high. Mark that for an optically thick system,a higher splitting percentage is expected for a fixed biasing limit in comparison to anoptically thin system.

Figure 3.15: The percentage of split photon packages with respect to the value of bdev. The errorbars, which are to small to be visible, indicate the 1σ deviation from the mean. The simulationsare run with 106 partly polychromatic photon packages.

58

Page 61: TineGeldof_Thesis fysica

Table 3.1: The percentage of split photon packages corresponding to each value bdev initiated inthe code. For each value, the simulation is run 10 times with 106 photon packages and differentrandom seeds set in the ski-files. Note that they are run over only one thread.

bdev Splitting percentage (%) Mean splitting (%)

.001 4694.9897 4695.3356 4692.1254 4694.3163 4694.2613 4694.60 ± 1.254696.2230 4696.0445 4694.8246 4694.7649 4693.1393

0.01 3221.1838 3222.8484 3222.0884 3219.4842 3219.9350 3221.19 ± 1.563220.1051 3221.7101 3222.2099 3223.5332 3218.7528

0.02 2657.6252 2659.0705 2659.6291 2656.3334 2657.9918 2658.49 ± 1.502656.7688 2658.2003 2658.7544 2658.9517 2661.6020

0.05 1943.9844 1943.5145 1942.6406 1946.8927 1944.7065 1944.82 ± 1.531945.7303 1943.8027 1946.6242 1943.7044 1946.6419

0.10 1449.6631 1453.3985 1452.2018 1450.3050 1451.2841 1451.63 ± 1.331451.7346 1452.8225 1450.2718 1453.4206 1451.1918

0.20 1017.9836 1020.3083 1021.1734 1020.7814 1019.5577 1019.74 ± 1.251017.8914 1020.7331 1018.2199 1020.5146 1020.2577

0.50 599.15080 557.59620 558.37340 559.12730 557.56570 558.39 ± 0.56558.6876 558.6691 558.2536 558.0005 558.4521

1.00 166.5530 166.2452 165.6225 167.1905 166.2773 166.74 ± 0.84166.2232 167.2300 168.6487 167.0575 166.3010

2.00 69.8238 70.8684 71.2305 71.1686 70.6973 70.81 ± 0.4570.9053 70.8708 71.2756 70.3255 70.9677

5.00 20.0567 20.6947 20.2920 20.6361 20.3802 20.43 ± 0.2420.3439 20.5637 20.8136 20.2990 20.2016

10.00 7.4751 7.7207 7.4768 7.5690 7.5768 7.536 ± 0.0967.4067 7.4442 7.6507 7.5107 7.5329

20.00 2.6312 2.7223 2.5809 2.6679 2.6651 2.660 ± 0.0722.5959 2.6472 2.8225 2.5892 2.6813

50.00 0.5796 0.5891 0.5904 0.6064 0.6393 0.584 ± 0.0270.5490 0.5746 0.5991 0.5531 0.5627

100.00 0.1608 0.1616 0.1526 0.1534 0.1834 0.154 ± 0.0140.1403 0.1324 0.1539 0.1467 0.1510

200.00 0.0260 0.0284 0.0241 0.0253 0.0306 0.0287 ± 0.00490.0235 0.0242 0.0348 0.0377 0.0319

59

Page 62: TineGeldof_Thesis fysica

The effect on the accuracy

We can now examine if more accurate results can be obtained when this photon split-ting technique is implemented and moreover investigate how the accuracy is influ-enced by the used deviation value bdev. From every 10 simulations summarized inTable 3.1 the noise corresponding to each biasing limit is calculated, i.e. the internaldifferences of the polychromatic code calculated with respect to the monochromaticcode. The reference monochromatic code used to compute these internal differencesutilizes 108 monochromatic photon packages, an amount high enough resulting in azero internal noise. From these noises, it is possible to compute the mean differencevalues xλ and their standard deviations σλ at every wavelength for every bdev-value.

As we want to examine the overall accuracy of the entire program in function of bdev,we will extract a mean deviation value at a certain wavelength, corresponding with aparticular bdev, together with its standard deviation. To decide at which wavelength(s)the accuracies have to be compared, we will investigate the simulated noise and exam-ine how this noise is influenced by bdev. The computed mean differences for 3 differentbdev-values are illustrated in figure 3.16. You can see that the scattered flux each timehas the highest percentage differences. (The percentage differences corresponding tothe other fluxes are so small that they can be caused by random processes. These noisesare hence averaged to zero.) Therefor, the accuracy of the simulations will be examinedbased on these scattered fluxes Fsca. In the 3 graphs in figure 3.16, a blue rectangle isdrawn that indicates a wavelength range where the accuracy is visibly affected by thechoice of the biasing limit. Choosing one wavelength in this box, for example 0.23 µm,allows us to determine how the accuracy is affected by the value of bdev. Extracting themean difference xλ=0.23 at this wavelength, the histogram in figure 3.17 is obtained,where x is represented by the red bars. The green error bars in the figure indicate the1σ deviation from this mean. Figure 3.17 should represent the general accuracy of thesimulations with a particular bdev initiated. Notice that the height of the red bars, rep-resenting the mean deviation from the reference simulation, are inversely proportionalto the accuracy of the simulation. Hence, a low bar corresponds to a high accuracy andvisa versa. One can observe that the accuracy is not drastically influenced for valueshigher than 10, as the percentage splitting is rather low for these values, i.e. less then7.5 %. For lower values of the biasing limit an increasing trend is visible: raising bdev

results in lower accuracies or higher mean deviations between the polychromatic andmonochromatic algorithms. We can again see that the important range of values forthe upper limit lies between 0.1 and 10, as was pointed out in section 3.4.2, but it is stillnot clear which value will be the most optimal choice. Mark that there is a higher peakfor bdev = 0.02. It is not really clear why this strict limit results in a low accuracy.

60

Page 63: TineGeldof_Thesis fysica

Figure 3.16: The mean deviations of the total (black), direct (red) and scattered (green) fluxes,computed for simulations using 106 partly polychromatic photon packages with respect to thereference simulation (using 108 monochromatic photon packages). The error bars indicate the1σ deviation from the mean. The blue rectangle specifies a wavelength range that is influencedby the choice of the biasing limit. Notice that the noise is already reduced by a factor 10 com-pared with figure 3.9, because 10 times more photon packages are launched.

In order to clarify this trend observed in figure 3.17, we redo the simulations for bias-ing limits ranging over the values 0.1 to 10, but this time for an optically thick model.For an increased optical depth, taking for example τλ = 100, the accuracy of the cal-culations will be influenced much more, which was already illustrated in figure 3.13.Hence, we expect the increasing trend that was visible in figure 3.17 to be far moreprominent. The result for the optically thick system is displayed in figure 3.18. Markthat for such a system, other splitting percentages are found for a fixed biasing limit incomparison to an optically thin system. The optimal bdev we are searching for in thisproject is thus only relevant for the spiral model used in the preceding sections, havinga lower optical depth. For other models, containing different optical depths, anothervalue of bdev can be found representing the optimal balance between the speed of the

61

Page 64: TineGeldof_Thesis fysica

Figure 3.17: The accuracy of the simulations with respect to the upper limit of the biasingfactor, computed for a wavelength of 0.232 µm. The error bars indicate the 1σ deviation fromthe mean.

Figure 3.18: The accuracy of simulations of optically thick models with respect to the upperlimit of the biasing factor, computed for a wavelength of 7.94 µm. The error bars indicate the1σ deviation from the mean. For every upper limit, the amount of photon splitting is indicatedin percents.

simulation and the accuracy.Examining the dependence of the accuracy on the upper limit of the biasing factor infigure 3.18, we indeed observe the same trend as found earlier which is, as expected,more prominently. Notice that for bdev ranging over 0.1 to 10 in the optically thick sys-tem, the splitting percentage ranges over only 359.74 ± 0.38 % to 519.52 ± 0.35 %. Forthe optically thin model, bdev = 0.1 - 10 corresponds to an amount of splitting ranging

62

Page 65: TineGeldof_Thesis fysica

over 7.536 ± 0.096% to 1451.63 ± 1.33 %. In other words, the amount of photon pack-age splitting should not be increased much in the optically thick model to observe theincreasing accuracy of the simulations.

3.4.3 Accuracy of the results

The photon splitting mechanism was mainly implemented to see if the noise of thesimulation could be reduced, without drastically increasing the simulation time. Fromthe above results, we can conclude that bdev = 5 is a relatively good choice for thelimit of the biasing factor. In this case, only 20.43 ± 0.24% of the polychromatic pho-ton packages will be split in the spiral galaxy model, while the accuracy is increasedclearly. This is also illustrated in figure 3.19, where the noise of the simulation with(bottom) and without (middle) photon splitting are compared, computed using 105

photon packages. The figure in the middle is the same as shown earlier in section 3.2.3.The bottom of figure 3.19 represents the calculated noise when a value of bdev = 5 isused to restrain the biasing factors. One can observe that the accuracy of the poly-chromatic algorithm is significantly improved when the technique of photon packagesplitting is used. The mean deviation of the simulations almost coincide with the dis-crepancy of 0%. Notice that this noise ranges over less than 1.4% (±0.7%), similar to theinternal differences returned by the monochromatic simulations (top of figure 3.19).With 5 as the upper limit for the biasing factors, we can start to examine the modelsfor dust emission and dust self-absorption, which will be done in subsections 3.5.1 and3.5.2.

63

Page 66: TineGeldof_Thesis fysica

Figure 3.19: Comparison of the scattered flux noise produced by the monochromatic and poly-chromatic algorithm. Top: noise obtained by simulations using 105 monochromatic photonpackages. Middle: noise for simulations using 105 polychromatic photon packages. Bottom:noise for simulations using 105 partly polychromatic photon packages. Although not neces-sary, the partly polychromatic photon packages where simulated at a range of wavelengthsspanning 0.1− 10 µm

64

Page 67: TineGeldof_Thesis fysica

3.5 Effects of dust self-absorption and emission

3.5.1 Thermal dust emission

Using the same optically thin spiral model as before, we can now investigate how thedust emission affects the SED of the system. In the ski-file of the spiral galaxy, a gray-body dust emissivity is added, which assumes LTE conditions. Under this assumption(which is valid for large grains) the dust emits as a modified blackbody. Changing theupper limit of the wavelength range from 10 µm to 500 µm, i.e. including the far IRspectrum, should show the thermal emission in the SED. We will use the technique ofpartly polychromatic photon packages in the SKIRT code, explained in the precedingsection, where the optimal biasing limit bdev = 5 is used. The result for the total fluxFtot obtained for the original and adapted code is displayed in figure 3.20 for both theface-on view (left) and edge-on view (right). This total flux is a combination of theflux obtained by the emitted stellar photon packages (the direct flux ), the flux that isscattered (scattered flux) and the flux resulting from the thermal dust emission (dustflux): Ftot = Fdir + Fsca + Fdust. The scattered flux and dust flux are shown in the figureas well, represented by the dashed red and green lines in the SED. These red and greencurves are, for the total, scattered and dust fluxes, almost indistinguishable. In the bot-tom of figure 3.20, the differences for all three flux types between the two simulationsare plotted. The percentage differences of the dust flux seem to increase towards theshorter wavelengths (below 10 µm). This is caused by the same problem encounteredin section 3.2.3, that is the low magnitude orders of the dust flux resulting in high per-centage differences. Therefore, we limit ourself to a range of 4 orders of magnitude ofthe dust flux in the SED.

As mentioned before, we always have to compare the obtained relative differencesbetween the monochromatic and polychromatic algorithm to the internal differencesof the code, i.e. the noise. As we want to investigate the thermal dust emission, we aregoing to examine the wavelength range covering 10 µm - 90 µm. Note that the simula-tions have to cover a wavelength range of 0.1 µm - 90 µm, otherwise there would be nophotons absorbed by the dust and emitted at longer wavelengths. In figure 3.21, thenoise of the dust flux is computed for both the monochromatic (top) and polychromaticalgorithm (bottom). This was done by running 10 simulations using 105 photon pack-ages with respect to a reference simulation using 108 monochromatic photon packages.One can clearly observe that the internal differences of the code are relatively high forwavelengths below 6 µm, even for the original monochromatic code. The dust fluxesare so low at these shorter wavelengths that they cause high errors.

65

Page 68: TineGeldof_Thesis fysica

Figu

re3.

20:

Top:

Com

pari

son

ofth

eSE

Dpl

ots

ofth

em

onoc

hrom

atic

(red

line)

and

poly

chro

mat

icph

oton

s(g

reen

line)

for

the

face

-on

view

(left)

and

edge

-on

view

(rig

ht).

The

gree

ncu

rve

iscl

earl

yco

vere

dby

the

red

curv

e.Th

eda

shed

red

and

gree

nlin

esre

pres

ent

the

scat

tere

dflu

xes

atsh

ort

wav

elen

gths

and

the

dust

fluxe

sat

long

erw

avel

engt

hs.

Bott

om:

The

diff

eren

cepl

otof

the

fluxe

sof

both

sim

ulat

ions

.Th

edi

ffer

ence

sar

eex

pres

sed

inpe

rcen

ts.

66

Page 69: TineGeldof_Thesis fysica

Figure 3.21: The noise computed for the face-on (left) and edge-on configuration (right) for thedirect flux densities. The error bars indicate the 1σ deviation from the mean. It seems thatthe internal differences of the codes below 6 µm are even very noisy for the monochromaticalgorithm.

It seems that the results obtained by the emission of dust grains in the polychromaticalgorithm are accurate, which can be seen in figures 3.20 and 3.21.When comprising the results in a 2-dimensional colored image, not much has changedwhen looking at the total, direct or scattered flux at low wavelength bins. This is dueto the fact that the contribution of thermal dust emission is not visible at these wave-lengths, as dust particularly emits in the IR and submm range. Ds9 is especially handyas it processes data and produces the images directly from FITS files. These used FITSfiles contain compressed information about the object at all important wavelengths.For displaying the emission of the dust in the galaxy, an image at higher wavelengthsmust be build, which is shown in figure 3.22. The spiral galaxy is viewed from aninclination of 0 and 90. As before, a bulge consisting of a Seric geometry is addedto the exponential disk to obtain a more realistic image. A simulation which uses 108

monochromatic photon packages is used as a reference simulation. The images whichare compared to this reference simulation are obtained by using 106 partly polychro-matic photon packages. When observing this images in the edge-on and face-on con-figurations, it is difficult to distinguish the frames obtained by both codes. To clarifythe differences between them, the residual frames are calculated using eq. 3.2, dis-played in figures 3.23 and 3.24.

67

Page 70: TineGeldof_Thesis fysica

Figure 3.22: L-band images (Near IR) of the galaxy produced by the photons emitted by dust.Left: edge-on configurations of the spiral galaxy produced with the reference simulation (top)and polychromatic algorithm with photon splitting (bottom). Right: face-on configurations ofthe reference simulation (left) and polychromatic algorithm (right).

Figure 3.23: The residuals of the edge-on frames resulting from the simulation using 106 partlypolychromatic photon packages and the reference L-band frames. From top to bottom thewavelength is increased from a shorter to longer wavelength bin in the IR. The color bar rep-resents percentage differences in levels of 12.5%, ranging from 0% (black) to 100% or more(white).

68

Page 71: TineGeldof_Thesis fysica

Figure 3.24: The residuals of the face-on frames resulting from the simulation using 106 partlypolychromatic photon packages and the reference L-band frames. From left to right the wave-length is increased from a shorter to longer wavelength bin in the IR. The color bar representspercentage differences in levels of 12.5%, ranging from 0% (black) to 100% or more (white).

3.5.2 Reaching internal equilibrium

The dust self-absorption phase will in a continuous manner emit and re-absorb thephoton packages several times. In this way it is possible to calculate the internal equi-librium temperature of the dust. This will make the simulations more realistic, espe-cially for certain types of dust components or for typical optically thick galaxies. Wenow want to investigate which effect this feature will have on the spiral galaxy modelthat is set up before. When running the simulation of the spiral galaxy, the dust self-absorption cycle was called twice before convergence was reached, i.e. before the totalabsorbed luminosity by the dust was approximately stable. After this phase, the dustemission phase began. A total amount of 55% photon packages were split when abiasing limit bdev equal to 5 was set. The results of the total flux densities for bothsimulations are displayed in figure 3.25 for the face-on view (left) and edge-on view(right). Comparing these results to figure 3.20 of the previous section, we can concludethat the effects of this process are almost negligible for this particular model. This iswhy we won’t go into further detail about this certain process.

69

Page 72: TineGeldof_Thesis fysica

Figu

re3.

25:

Top:

Com

pari

son

ofth

eSE

Dpl

ots

ofth

em

onoc

hrom

atic

(red

line)

and

poly

chro

mat

icph

oton

s(g

reen

line)

for

the

face

-on

view

(left)

and

edge

-on

view

(rig

ht).

The

gree

ncu

rve

iscl

earl

yco

vere

dby

the

red

curv

e.Th

eda

shed

red

and

gree

nlin

esre

pres

ent

the

scat

tere

dflu

xes

atsh

ort

wav

elen

gths

and

the

dust

fluxe

sat

long

erw

avel

engt

hs.

Bott

om:

The

diff

eren

cepl

otof

the

fluxe

sof

both

sim

ulat

ions

.Th

edi

ffer

ence

sar

eex

pres

sed

inpe

rcen

ts.

70

Page 73: TineGeldof_Thesis fysica

3.6 RGB images

When a simulation is run with monochromatic photon packages, a high noise is foundin the RGB images. On the edges of the galaxies, only a few monochromatic photonpackages will arrive. Because of this, it could happen that in one particular pixel amonochromatic photon, having a short wavelength, is detected, while in the neigh-boring pixel a monochromatic photon with a longer wavelength will be detected. Inother words, two neighboring pixels in the RGB image could have opposing colors,e.g. the one can be red while the other is blue. One of the expected benefits of the poly-chromatic algorithm is that this technique will reduce the noise in these color images.Every photon calculated can contribute to the output images at all wavelengths insteadof a single wavelength. Hence, a certain pixel in the image will have a contribution ofseveral colors, as well as his neighboring pixel.

In figure 3.26 the RGB images of the spiral galaxy, consisting of an exponential disk anda Seric bulge, is displayed. These images are computed by using the frame containingwavelength 0.4 µm for the Blue channel, the frame containing wavelength 3 µm for theRed channel and finally the frame containing wavelength 0.5 µm for the Green channel.The left image results from the simulation of 106 monochromatic photon packages, theright image is obtained by the polychromatic algorithm with 106 polychromatic pho-ton packages. When zooming in at the edge of the galaxy, the separated pixels can bedistinguished. One should have a very close look to observe the noise induced by themonochromatic algorithm, displayed in the top left corner of figure 3.26. Between thegreen pixels, some blue and red areas can be found. Having a closer look at the pixelsin the top right corner of figure 3.26, where the pixel values are calculated by the poly-chromatic algorithm, this noise seems to be more than adequately reduced. Notice thatthe dust lane of the galaxy is clearly visible, as mostly red pixels are displayed in thisarea. This effect can be compared to the red light one observes at sunset. The blue lightof the sun, having a short wavelength, is effectively absorbed and scattered by the ticklayer of atmosphere it crosses, while the red light having a longer wavelength can passright through it. In figure 3.26, the photons with the lowest wavelengths are absorbedalmost entirely. On the other hand, the dust lane is practically transparent for photonswith long wavelengths.

71

Page 74: TineGeldof_Thesis fysica

Figure 3.26: RGB image of a spiral galaxy composed of an exponential disk and a Seric bulge,viewed from inclination of 88. A small patch of the image constructed by the monochromaticalgorithm (left) and polychromatic algorithm (right) are enlarged such that the different pixelscan be distinguished.

72

Page 75: TineGeldof_Thesis fysica

3.7 Overview

Investigating the accuracy of the polychromatic algorithm was done in a few steps,each of them tested for some basic stellar and dusty models. Firstly, a stellar modelcomposed of two Plummer spheres was constructed in section 3.1, containing no dustin its system. In this way we discovered that the stellar emission was not affected bythe use of this optimization technique, as was expected. Hence, the same results whereobtained as was gained for the simulations that use monochromatic photon packages.Secondly, an edge-on spiral galaxy was constructed, consisting of an exponential stel-lar and dust disk and a Seric bulge, where we discounted the thermal dust emission.The effects of the implementation on the process of extinction was investigated in sec-tions 3.2.2 and 3.2.3, showing that it does indeed reproduce approximately the sameresults as obtained with the original simulation. However, in section 3.3 it seemed thatpolychromatic photon packages could induce a problem in very optically thick mod-els, as extremely large weighting factors could occur (eq. 1.12 can increase withoutbound). This suggest that a proper choice of a reference wavelength, a characteristicof the polychromatic photon package, is indeed crucial for the accuracy of the method.We thought of a possible solution, by which we introduced partly polychromatic photonpackages in section 3.4, to cope with the drawback that arose from using biasing factors.To find the perfect balance between the speed of the simulation and the accuracy, anoptimal biasing limit was searched for. When this was found, the results could finallybe tested for thermal dust emission and even dust self-absorption.

From the above investigations, it seemed that we achieved two important aspects ofthe polychromatic algorithm. As figures 3.4, 3.5 and 3.19 point out, using polychro-matic photon packages in SKIRT can indeed reproduce accurate results, especially foroptically thin systems. From this we can conclude that this optimization technique canindeed improve the code for systems with low optical depths.Another realization is that the high noise in the color images produced by the monochro-matic algorithm is reduced when polychromatic photons are used in the simulations.This improvement was visible in figure 3.26.

73

Page 76: TineGeldof_Thesis fysica

74

Page 77: TineGeldof_Thesis fysica

Discussion and future prospects 4In this thesis project, we introduced the technique of Polychromatism that is meant to op-timize dust radiative transfer codes. This method was somewhat controversial, sinceone was not certain whether the advantages outweigh the disadvantages induced bythis technique. It has already been implemented and tested before in a free MonteCarlo dust radiative transfer code called SUNRISE [Jonsson, 2006], where they insuredthat the use of polychromatic photon packages significantly improves the calculationsin efficiency and accuracy. Here, we tried to implement this optimization techniquein the radiative transfer code SKIRT, developed by the UGent astronomy department.Our main concern during this thesis was whether this implementation would returnaccurate results.

Investigating the accuracy of the optimization method was done in three steps. Firstly,a stellar model composed of two Plummer spheres was constructed, without a dustymedium. In this way, we discovered that the stellar emission was not affected by theuse of this technique, as was expected. Afterwards, an edge-on spiral galaxy was con-structed, where we discounted the thermal dust emission in the calculations. As theeffects of the implementation on the process of extinction were investigated, we expe-rienced a big disadvantage of the polychromatic algorithm,. The technique induced aproblem in very optically thick models. This is why partly polychromatic photon packageswhere introduced, to cope with the drawback that arose from using biasing factors.To find the perfect balance between the speed of the simulation and the accuracy, anoptimal biasing limit was searched for. When this was achieved, we found that thepolychromatic algorithm could indeed reproduced accurate results. Finally, the resultscould be tested for thermal dust emission and dust self-absorption, which again pro-duced more than adequate results.

Accept for the optically thick cases, we can conclude that the code indeed works prop-erly. One of our main concerns was whether this technique could reproduce accurateresults, which was undoubtedly the fact for optically thin systems.An increased speed was one of the expected benefits the polychromatic algorithm

Page 78: TineGeldof_Thesis fysica

would have. However, this expectation could not be realized here, because the sim-ulations needed to be run on only one thread when the photons were being split.Hence, one of the most important speed-up algorithms in SKIRT, i.e. the task paral-lelism, could not be used. Because of this, we did not focus on the efficiency of theoptimization technique, as the code was probably implemented very inefficiently. Thismade it impossible to compare the speeds of both codes.A second benefit of the implemented optimization technique is the reduced noise inthe color images. This was observed when comparing the RGB images of a galaxysimulated by both the monochromatic and polychromatic algorithm. One had to takea very close look at the pixels at the edge of the galaxy before this noise was visible. Itappeared that the noise was indeed reduced, which fortunately satisfies our expecta-tions.

The implementation of the polychromatic algorithm has only just started. Alterna-tive methods for minimizing the impact of large weighting factors in different modelsshould still be explored. In this thesis, we made use of ray splitting, but this is probablynot the only possible solution to cope with high biasing factors.The future of three-dimensional dust radiative transfer is bright. SKIRT is still develop-ing every day by introducing new applications, optimizations techniques and increas-ing acceleration algorithms in the code. The code will more and more be used for notonly physical effects in astrophysical objects, but in other fields of studies that need 3DRT simulations as well, for example in order to predict light propagation in biologicaltissue. We expect new future algorithms to include time dependence in the 3D RT prob-lem, which could be important in the context of star formation or episodic accretion.Another optimization would be the use of dynamical grids, in which the grid would beadjusted throughout the simulation, based on intermediate results of the calculations.Thanks to the increasing computational power given by available massively parallelmachines, new algorithms can be developed that are optimized to run on many pro-cessors. One of these algorithms makes use of MPI interface for data parallelism, inorder to allow MC simulations to be run on distributed memory systems.

76

Page 79: TineGeldof_Thesis fysica

Discussie 5In deze master thesis werd een specifieke techniek geıntroduceerd, die gebruik maaktvan een polychromatisch algoritme, met als doel het optimaliseren van Monte Carlostralingsoverdracht codes. Deze techniek was tot op heden nog controversieel, geziener nog geen duidelijkheid is of de voordelen van de methode opwegen tegen de nade-len. Het polychromatisch algoritme werd reeds eerder geımplementeerd en getestin een gratis verkrijgbare Monte Carlo stralingsoverdracht code genaamd SUNRISE

[Jonsson, 2006]. Hierbij verzekerde men dat het gebruik van polychrome foton pakket-ten de nodige berekeningen in efficientie en nauwkeurigheid kan verbeteren. In ditproject trachtten we deze optimalisatie techniek te implementeren in de Monte Carlostralingsoverdracht code SKIRT, een programma ontwikkeld door de afdeling Ster-renkunde aan de UGent. De grootste uitdaging hierbij bestond uit de vraag of dezeimplementatie kan zorgen voor accurate resultaten.

Het onderzoek naar de nauwkeurigheid van deze optimalisatie techniek werd verrichtin drie opeenvolgende stappen. Als eerste werd een stellair model bestaande uit tweePlummer sferen gecreeerd, zonder stof aanwezig in het systeem. Hierbij kan gecon-cludeerd worden dat de stellaire emissie zoals niet werd beınvloed door het gebruikvan deze techniek. Vervolgens werd een model opgebouwd bestaande uit een expo-nentiele stellaire schijf en een exponentiele stofschijf. Hierbij werd thermische emissiedoor stof buiten beschouwing gelaten. De effecten van polychromatische fotonen ophet extinctie proces konden zo onderzocht worden. Door het gebruik van biasing fac-toren werd echter een groot nadeel ondervonden in zeer optisch dikke modellen. Alsoplossing hiervoor werd een foton splittng techniek geıntroduceerd, die het mogelijkmaakte om de omvang van de biasing factoren te limiteren. Om een perfect evenwichtterug te vinden tussen de snelheid van de simulatie en de nauwkeurigheid, werd naareen optimale biasing limiet gezocht. Eens deze waarde gevonden was werden de sim-ulaties veel nauwkeuriger. Het bleek zelf dat een betere nauwkeurigheid verkregenwerd i.v.m het monochromatisch algoritme. Tenslotte was het mogelijk de resultatente toetsen aan thermische stofemissie en stof zelf-absorptie.

Page 80: TineGeldof_Thesis fysica

Met uitzondering van optisch dikke modellen kunnen we concluderen dat de codewel degelijk werkt. Een van onze belangrijkste doelstellingen was het verkrijgen vannauwkeurige resultaten, wat welzeker mogelijk was voor optisch dunne systemen.Het gebruik van polychrome foton pakketten zou de simulatietijd drastisch moetenkunnen verminderen. Deze verwachting kon hier echter niet gerealiseerd worden.Indien de foton pakketten opgesplitst werden, dienden de simulaties op slechts eenthread gerund te worden. Hierdoor kon een van de belangrijkste mechanismen inSKIRT, i.e. zogenaamde taak parallellisatie, niet benuttigt worden. Door het feit datde implementatie hoogstwaaschijnlijk zeer inefficient is, hebben we onze focus nietgelegd op het bereiken van een hogere efficientie van de berekeningen. Het tweedevoordeel dat verwacht werd voor deze optimalisatie techniek werd daarintegen welbereikt. Bij het vergelijken van de RGB-beelden van een model gesimuleerd doorzowel het monochromatische als het polychromatische algoritme, kon een verlaagderuis waargenomen worden. Dit verwachtte effect is een grote verbetering.

Het polychromatisch algoritme staat momenteel nog in zijn kinderschoenen. Deze isnog niet optimaal en men dient nog steeds onderzoek te verrichten naar alternatievemethoden die de impact van grote biasing factoren kunnen minimaliseren. In ditproject werd gebruik gemaakt van een foton splitsen techniek, al is dit waarschijn-lijk niet de enige mogelijke oplossing.De toekomst van de 3-D stralingsoverdracht technieken is bovendien zeer helder. SKIRTis nog steeds aan het ontwikkelen: nieuwe toepassingen, optimalisatie technieken enversnellings-algoritmen worden vandaag nog steeds toegevoegd aan de code. De codewordt momenteel hoofdzakelijk gebruikt voor fysische effecten in astrofysische ob-jecten te onderzoeken. Meer en meer zal deze code zijn toepassing vinden in anderevakgebieden waar 3D RT simulaties nodig zijn, denk bijvoorbeeld aan het onderzoekin het voorspellen van de propagatie van licht in biologisch weefsel. We verwachtenin de toekomst een grote opkomst van nieuwe algoritmes, die het bijvoorbeeld mo-gelijk maken om een tijdsafhankelijkheid in het 3D RT probleem te verwerken. Ditkan ondermeer van belang zijn in het onderzoek naar stervorming of episodische ac-cretie. Een andere mogelijke optimalisatie is het gebruik van dynamische grids in deMC routine, waarbij het grid dynamisch wordt bijgestuurd doorheen de simulatie opbasis van tussentijds berekende resultaten. Bovendien kunnen door de toenemendecomputationele kracht gegeven door beschikbare parallelle machines nieuwe algorit-men ontwikkeld worden die geoptimaliseerd zijn om op vele processoren te simuleren.Een van deze algoritmen maakt gebruik van MPI voor data parallellisme, zodat MCsimulaties uitgevoerd kunnen worden op verdeelde geheugensystemen.

78

Page 81: TineGeldof_Thesis fysica

Bibliography

[Baes, 2001] Baes, M. (2001). The effects of dust absorption and scattering on the kinematicsof galaxies. PhD thesis, Ghent University.

[Baes, 2012] Baes, M. (2012). Extragalactische Sterrenkunde, chapter 4, pages 111–115.Ghent University.

[Baes et al., 2003] Baes, M., Davies, J., Dejonghe, H., Sabatini, S., Roberts, S., Evans, R.,Linder, S., Smith, R., and Blok, W. D. (2003). Radiative transfer in disc galaxies – III.The observed kinematics of dusty disc galaxies. MNRAS, 343:1081.

[Baes and Dejonghe, 2002a] Baes, M. and Dejonghe, H. (2002a). Kinematics of ellipti-cal galaxies with a diffuse dust component – III. A monte carlo approach to includethe effects of scattering. MNRAS, 335:441.

[Baes and Dejonghe, 2002b] Baes, M. and Dejonghe, H. (2002b). Radiative transfer indisc galaxies – I. A comparison of four methods to solve the transfer equation inplane-parallel geometry. MNRAS, 326(2):722–732.

[Baes et al., 2005] Baes, M., Stamatellos, D., Davies, J., Whitworth, A., Sabatini, S.,nd S.M. Linder, S. R., and Evans, R. (2005). Radiative equilibrium in Monte Carloradiative transfer using frequency distribution adjustment. New Astron., 10:523.

[Baes et al., 2011] Baes, M., Verstappen, J., Looze, I., Fritz, J., Saftly, W., and Perez, E.(2011). Efficient three-dimensional NLTE dust radiative transfer with SKIRT. TheAstrophysic Joural Supplement Series, 196:22–37.

[Camps, 2013] Camps, P. (2013). SKIRT Workshop. Ghent University.

[Dullemond and Turolla, 2000] Dullemond, C. and Turolla, R. (2000). An efficient al-gorithm for two-dimensional radiative transfer in axisymmetric circumstellar en-velopes and disks. Astronomy and Astrophysics, 360:1187.

[Jonsson, 2006] Jonsson, P. (2006). SUNRISE: polychromatic dust radiative transferarbitrary geometries. Mon. Not. R. Astron. Soc., 372:2–20.

[Popescu and Tuffs, 2005] Popescu, C. C. and Tuffs, R. J., editors (2005). The SpectralEnergy Distributions of Gas-Rich Galaxies: Confronting Models with Data, volume 761of American Institute of Physics Conference Series.

Page 82: TineGeldof_Thesis fysica

[Quinn, 2004] Quinn, M. (2004). Parallel Programming in C with MPI and OpenMP.McGraw-Hill Inc., New York. ISBM 0-07-058201-7.

[Steinacker et al., 2013] Steinacker, J., Baes, M., and Gordon, K. (2013). Three-Dimensional Dust Radiative Transfer. Annu. Rev. Astronomy and Astrophysics, 51:41.

80