This page summarizes some of the techniques implemented in SKIRT's photon packet life cycle and indicates how to configure the corresponding options in the parameter file.
The Monte Carlo radiative transfer method employed by SKIRT essentially emulates the relevant physics by following a stream of individual photon packets on "random" paths through the medium. Each photon packet represents a given number of photons at a particular wavelength (see the PhotonPacket class and Wavelength during the photon packet life cycle). During the photon packet life cycle, all emission and interaction events are governed by the probability distribution relecting the physical process being represented. In practice, however, various variance reduction and acceleration techniques may prescribe using an adjusted probability distribution to improve the chances that the packets efficiently trace the relevant aspects of the model. In such case, the change is compensated by applying a bias factor to the weight of the photon packet, i.e. to the number of photons being represented.
Two types of registration occur during the photon packet life cycle. The packet's contribution to the radiation field is recorded continually as the packet crosses spatial cells along its path. The synthetic observations maintained by the configured instruments are constructed using the peel-off technique. Rather than detecting only photon packets that escape from the simulated model, a peel-off photon packet is sent to the instruments at each emission and scattering event. With the appropriate bias factors, this method produces the correct results much more quickly.
The MonteCarloSimulation class implements the photon packet life cycle in SKIRT, calling on the other components of the simulation such as sources, media and instruments to perform many of the actual, concrete steps along the way. For more information, see the documentation of the MonteCarloSimulation class and its functions.
When emitting a new photon packet, key characteristics to be determined include the originating position and the initial wavelength of the packet. In both cases, SKIRT allows configuring a number of biasing options to achieve optimal efficiency.
The spatial biasing mechanisms control the relative number of photon packets emitted for each source and for each entity within each source, if applicable. Although the default settings are usually sufficient, we briefly describe the options here.
At the top level, for primary sources, the sourceBias property of the SourceSystem and the sourceWeight properties for each Source in combination with the bolometric luminosity of each source control a composite biasing scheme to distribute photon packets over the sources. With the default settings (source bias of 0.5 and source weights of 1), this means half of the photon packets are distributed equally over the sources, and the other half is distributed over the sources proportional to their luminosity. This ensures that more luminous sources get more attention without smothering less luminous sources. For details, see the SourceSystem class documentation.
For secondary sources, a similar composite biasing scheme is controlled by the sourceBias property in the SecondaryEmissionOptions and the sourceWeight property in the DustEmissionOptions (for all dust media combined) or the EmittingGasMix base class (for each of the emitting gas medium components). For details, see the SecondarySourceSystem class documentation.
For imported primary sources and all secondary sources, there is a nested biasing level for distributing photon packets over the cells or particles making up the source. For imported primary sources, the nested scheme is controlled by the sourceBias property of the SourceSystem (i.e. the same value used for the top-level scheme) and the luminosities of the subsources (i.e. all entities are assumed to have the same source weight value). For details, see the ImportedSource::prepareForLaunch() function documentation. For secondary sources, the nested scheme (distributing the photon packets over the cells of the spatial grid in the simulation) is controlled by spatialBias property of the SecondaryEmissionOptions and the luminosities of the cells. Again, with the default settings (spatial bias of 0.5), half of the photon packets are distributed equally over the cells, and the other half is distributed over the cells proportional to their luminosity. For details, see the SecondarySourceSystem class documentation.
The spectral biasing mechanisms control the relative number of photon packets emitted at various wavelengths. These options are discussed in Configuring wavelength grids, for both primary and secondary sources.
The PhotonPacketOptions allow configuring four basic variations of the photon packet life cycle by enabling or disabling the explicit absorption technique and/or the forced scattering technique. Each of these variations comes with specific advantages or drawbacks, as follows:
For more details on these variations, see the documentation for the MonteCarloSimulation::performLifeCycle() function and functions used therein.
The relative performance of the photon packet life cycle variations depends on the model geometry, the medium properties and the type of synthetic observations, so that there is no single optimal choice. Nevertheless, we can propose the following overall rules of thumb:
In our experience, with these rules, the simulation may perform sub-optimally but not dramatically so. Note that, for historical reasons, explicit absorption is disabled by default.
The PhotonPacketOptions include additional properties that allow configuring some aspects of the forced scattering photon packet life cycle. The values of these properties are not used if forced scattering is disabled.
The minWeightReduction property sets the weight reduction factor at which a photon packet is terminated, relative to its initial weight. The forced scattering technique requires this criterion because otherwise packets would continue to move around in the model indefinitely. The default value is usually appropriate, and needs to be increased only for some extreme benchmark models.
The minScattEvents property sets the minimum number of scattering events before a photon packet can be terminated, even if its weight has decreased by more than the specified weight reduction factor. The default value of zero (i.e. no minimum number of scattering events) is usually appropriate. Increasing this value may improve the signal-to-noise ratio of the N-times scattered flux component when studying the scattering behavior of a model. See the numScatteringLevels property of Instrument and its description below.
The pathLengthBias property sets the fraction of photon packet free path lengths that will sampled from a stretched probability distribution as opposed to the regular probability distribution, resulting in longer free paths on average. As a result, photon packets more easily penetrate regions of high optical depth in the medium. The default value of 0.5 is usually appropriate, with the following important caveat. The path length stretching technique cannot be used when the wavelength of a photon packet may change during its life cycle, for example because of Doppler shifts. SKIRT issues a warning when it detects these situations and automatically forces the path length bias value to zero. This warning can be silenced by setting pathLengthBias to zero in the parameter file.
Simulations that include secondary emission or self-consistent iterations always store the radiation field. However, one might be interested in probing the radiation field (see RadiationFieldProbe) resulting from primary emission without the need for secondary emission or iterations. In this case, and if forced scattering is enabled, the storeRadiationField property in the RadiationFieldOptions allows enabling this capability (the current implementation of the life cycle without forced scattering does not allow storing the radiation field).
On a related note, by default, the radiation field is not updated during the final secondary emission phase because this information is no longer needed by the simulation. However, one may want to probe such an updated radiation field at the end of the simulation. This can be achieved by setting the storeEmissionRadiationField property in the SecondaryEmissionOptions to true.
Whenever the radiation field is being stored (by default or specifically requested by the user), an appropriate wavelength grid must be configured for the radiationFieldWLG property of the RadiationFieldOptions. For recommendations, see Configuring wavelength grids.
In addition to the total observed flux, SKIRT instruments can also record flux components separately, differentiating for example direct and scattered fluxes originating from primary and secondary sources. To enable this capability for a particular Instrument instance, set its recordComponents property to true. The numScatteringLevels property then determines the number of individually recorded scattering levels (zero by default). Setting a nonzero number can be meaningful when studying the N-times scattering behavior of a model. For more details, see the documentation of the Instrument and FluxRecorder classes.
Each instrument must also be equipped with a wavelength grid. For recommendations, see Configuring wavelength grids.