The SKIRT project
advanced radiative transfer for astrophysics
Source Class Referenceabstract

#include <Source.hpp>

Inheritance diagram for Source:

Public Member Functions

virtual int dimension () const =0
virtual bool hasVelocity () const =0
virtual void launch (PhotonPacket *pp, size_t historyIndex, double L) const =0
virtual double luminosity () const =0
virtual void prepareForLaunch (double sourceBias, size_t firstIndex, size_t numIndices)
double sourceWeight () const
virtual double specificLuminosity (double wavelength) const =0
double wavelengthBias () const
WavelengthDistributionwavelengthBiasDistribution () const
Public Member Functions inherited from SimulationItem
template<class T>
T * find (bool setup=true) const
template<class T>
T * interface (int levels=-999999, bool setup=true) const
virtual string itemName () const
void setup ()
string typeAndName () const
Public Member Functions inherited from Item
 Item (const Item &)=delete
virtual ~Item ()
void addChild (Item *child)
const vector< Item * > & children () const
virtual void clearItemListProperty (const PropertyDef *property)
void destroyChild (Item *child)
virtual bool getBoolProperty (const PropertyDef *property) const
virtual vector< double > getDoubleListProperty (const PropertyDef *property) const
virtual double getDoubleProperty (const PropertyDef *property) const
virtual string getEnumProperty (const PropertyDef *property) const
virtual int getIntProperty (const PropertyDef *property) const
virtual vector< Item * > getItemListProperty (const PropertyDef *property) const
virtual ItemgetItemProperty (const PropertyDef *property) const
virtual string getStringProperty (const PropertyDef *property) const
int getUtilityProperty (string name) const
virtual void insertIntoItemListProperty (const PropertyDef *property, int index, Item *item)
Itemoperator= (const Item &)=delete
Itemparent () const
virtual void removeFromItemListProperty (const PropertyDef *property, int index)
virtual void setBoolProperty (const PropertyDef *property, bool value)
virtual void setDoubleListProperty (const PropertyDef *property, vector< double > value)
virtual void setDoubleProperty (const PropertyDef *property, double value)
virtual void setEnumProperty (const PropertyDef *property, string value)
virtual void setIntProperty (const PropertyDef *property, int value)
virtual void setItemProperty (const PropertyDef *property, Item *item)
virtual void setStringProperty (const PropertyDef *property, string value)
void setUtilityProperty (string name, int value)
virtual string type () const
Public Member Functions inherited from WavelengthRangeInterface
virtual ~WavelengthRangeInterface ()
virtual Range wavelengthRange () const =0

Protected Member Functions

 Source ()
void informAvailableWavelengthRange (Range available, string itemType)
Randomrandom () const
void setupSelfBefore () override
Protected Member Functions inherited from SimulationItem
 SimulationItem ()
virtual bool offersInterface (const std::type_info &interfaceTypeInfo) const
virtual void setupSelfAfter ()
Protected Member Functions inherited from Item
 Item ()
Protected Member Functions inherited from SourceWavelengthRangeInterface
 SourceWavelengthRangeInterface ()
Protected Member Functions inherited from WavelengthRangeInterface
 WavelengthRangeInterface ()

Private Types

using BaseType
using ItemType

Private Attributes

Random_random
double _sourceWeight
double _wavelengthBias
WavelengthDistribution_wavelengthBiasDistribution

Friends

class ItemRegistry

Detailed Description

Source is an abstract class representing a primary radiation source in the simulation. Each source (an instance of a Source subclass) must define the following information at each point in the spatial domain of the source (which is independent of the spatial grid in the simulation):

  • The spectral energy distribution (SED) of the emission averaged over the unit sphere.
  • Some normalization for the luminosity (e.g., bolometric, at a given wavelength, ...).
  • If the emission is anisotropic, the rest-frame angular distribution of the emission.
  • If the emission is polarized, the polarization state of the emission in each direction.
  • The velocity of the source relative to the model coordinate frame.

Furthermore, each source has a function for launching a photon packet that proceeds roughly as follows:

  • Sample a location from the spatial density distribution.
  • Sample a wavelength from the SED at that location (also see below).
  • Determine the corresponding (possibly biased) luminosity weight
  • Determine the rest-frame angular distribution of the emission at that location and at that wavelength, i.e. an object offering the AngularDistribution interface (functions to return a random direction, and to return the probability for a given direction)
  • Determine the polarization state of the emission at that location and at that wavelength, i.e. an object offering the PolarizationState interface (function to return a Stokes vector for a given direction)
  • Determine the velocity of the source at that location
  • Pass the items listed above to the photon packet launch procedure

Wavelengths for new photon packets can be sampled from the intrinsic spectral distribution of the source \(s(\lambda)\) and/or from a bias wavelength distribution \(b(\lambda)\). Both the bias fraction \(\xi\) and the bias distribution \(b(\lambda)\) can be configured by the user. Given these distributions and bias factor, the composite distribution \(q(\lambda)\) is

\[ q(\lambda) = (1-\xi) s(\lambda) + \xi b(\lambda) \]

and the corresponding biasing weight factor becomes

\[ w(\lambda) = \frac{s(\lambda)}{q(\lambda)} = \frac{s(\lambda)}{(1-\xi) s(\lambda) + \xi b(\lambda)} \]

By default, half of the photon packet wavelengths are sampled from each of the distributions, and the default bias distribution spreads wavelengths logarithmically over the wavelength range of the source (more precisely, the logarithm of the wavelength is distributed uniformly).

Properties of sub-types of this type are listed in user interfaces somewhere in between the properties of this type.

Constructor & Destructor Documentation

◆ Source()

Source::Source ( )
inlineprotected

Default constructor for abstract Item subclass Source: "a primary radiation source".

Member Function Documentation

◆ dimension()

virtual int Source::dimension ( ) const
pure virtual

This function returns the dimension of the source, which depends on the (lack of) symmetry of its geometry. A value of 1 means spherical symmetry, 2 means axial symmetry and 3 means none of these symmetries.

Implemented in FilePolarizedPointSource, GeometricSource, ImportedSource, and SpecialtySource.

◆ hasVelocity()

virtual bool Source::hasVelocity ( ) const
pure virtual

This function returns true if this source may have a nonzero velocity for some positions. It may be called before setup of the receiving source has completed.

Implemented in FilePolarizedPointSource, GeometricSource, ImportedSource, and SpecialtySource.

◆ informAvailableWavelengthRange()

void Source::informAvailableWavelengthRange ( Range available,
string itemType )
protected

This function logs a warning message if the given range is smaller than the configured source wavelength range. The second argument specifies the type of the simulation item to be included in the message. This function can be called from subclasses.

◆ launch()

virtual void Source::launch ( PhotonPacket * pp,
size_t historyIndex,
double L ) const
pure virtual

This function causes the photon packet pp to be launched from the source using the given history index and luminosity contribution. The photon packet's contents is fully (re-)initialized so that it is ready to start its lifecycle.

Implemented in FilePolarizedPointSource, ImportedSource, and NormalizedSource.

◆ luminosity()

virtual double Source::luminosity ( ) const
pure virtual

This function returns the luminosity \(L\) (i.e. radiative power) of the source integrated over the wavelength range of primary sources (configured for the source system as a whole) and across its complete spatial domain.

Implemented in FilePolarizedPointSource, ImportedSource, and NormalizedSource.

◆ prepareForLaunch()

virtual void Source::prepareForLaunch ( double sourceBias,
size_t firstIndex,
size_t numIndices )
virtual

This function may perform some preparations for launching photon packets. It is called in serial mode before each segment of photon packet launches, providing the history indices mapped by the source system to this particular source. This allows the source to further map these indices to subsources if that would be meaningful. See the description of the SourceSystem class for more information. The default implementation of this function does nothing.

Reimplemented in ImportedSource.

◆ random()

Random * Source::random ( ) const
inlineprotected

This function returns the simulation's random generator as a service to subclasses.

◆ setupSelfBefore()

void Source::setupSelfBefore ( )
overrideprotectedvirtual

This function caches the simulation's random generator for use by subclasses.

Reimplemented from SimulationItem.

Reimplemented in SpecialtySource.

◆ sourceWeight()

double Source::sourceWeight ( ) const
inline

This function returns the value of the discoverable double property sourceWeight: "the weight of this source for the number of photon packets launched".

The minimum value for this property is "]0".

The maximum value for this property is "1000]".

The default value for this property is given by the conditional value expression "1".

This property is displayed only if the Boolean expression "Level3" evaluates to true after replacing the names by true or false depending on their presence.

◆ specificLuminosity()

virtual double Source::specificLuminosity ( double wavelength) const
pure virtual

This function returns the specific luminosity \(L_\lambda\) (i.e. radiative power per unit of wavelength) of the source at the specified wavelength, or zero if the wavelength is outside the wavelength range of primary sources (configured for the source system as a whole) or if the source simply does not emit at the wavelength.

Implemented in FilePolarizedPointSource, ImportedSource, and NormalizedSource.

◆ wavelengthBias()

double Source::wavelengthBias ( ) const
inline

This function returns the value of the discoverable double property wavelengthBias: "the fraction of photon packet wavelengths sampled from a bias distribution".

The minimum value for this property is "[0".

The maximum value for this property is "1]".

The default value for this property is given by the conditional value expression "0.5".

This property is relevant only if the Boolean expression "Panchromatic" evaluates to true after replacing the names by true or false depending on their presence.

This property is displayed only if the Boolean expression "Level3" evaluates to true after replacing the names by true or false depending on their presence.

◆ wavelengthBiasDistribution()

WavelengthDistribution * Source::wavelengthBiasDistribution ( ) const
inline

This function returns the value of the discoverable item property wavelengthBiasDistribution: "the bias distribution for sampling photon packet wavelengths".

The default value for this property is given by the conditional value expression "DefaultWavelengthDistribution".

This property is relevant only if the Boolean expression "Panchromatic&wavelengthBias" evaluates to true after replacing the names by true or false depending on their presence.

This property is displayed only if the Boolean expression "Level3" evaluates to true after replacing the names by true or false depending on their presence.


The documentation for this class was generated from the following file: