The SKIRT project
advanced radiative transfer for astrophysics
CubicalBackgroundSource Class Reference

#include <CubicalBackgroundSource.hpp>

Inheritance diagram for CubicalBackgroundSource:

Public Member Functions

double edgeLength () const
int intrinsicDimension () const override
void launchSpecialty (PhotonPacket *pp, size_t historyIndex, double lambda, double Lw, VelocityInterface *bvi) const override
Public Member Functions inherited from CenteredSource
double centerX () const
double centerY () const
double centerZ () const
int geometryDimension () const override
Public Member Functions inherited from SpecialtySource
int dimension () const override
bool hasVelocity () const override
void launchNormalized (PhotonPacket *pp, size_t historyIndex, double lambda, double Lw) const override
Vec velocity () const override
double velocityX () const
double velocityY () const
double velocityZ () const
Public Member Functions inherited from NormalizedSource
void launch (PhotonPacket *pp, size_t historyIndex, double L) const override
double luminosity () const override
LuminosityNormalizationnormalization () const
SEDsed () const
double specificLuminosity (double wavelength) const override
Range wavelengthRange () const override
Public Member Functions inherited from Source
virtual void prepareForLaunch (double sourceBias, size_t firstIndex, size_t numIndices)
double sourceWeight () const
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 ()
Public Member Functions inherited from VelocityInterface
virtual ~VelocityInterface ()

Protected Member Functions

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

Private Types

using BaseType
using ItemType

Private Attributes

double _edgeLength

Friends

class ItemRegistry

Detailed Description

The CubicalBackgroundSource class represents the surface of a cube (i.e. the combination of the six walls) from which radiation escapes in the inward direction. The emissivity is anisotropic: there is no radiation outwards and the inward emissivity from each wall is proportional to \(\cos\theta'\), where \(\theta'\) is the angle between the direction and the normal on the wall.

When an item of this type is used, the names provided by the conditional value expression "Dimension3" are inserted into the name sets used for evaluating Boolean expressions.

Constructor & Destructor Documentation

◆ CubicalBackgroundSource()

CubicalBackgroundSource::CubicalBackgroundSource ( )
inlineprotected

Default constructor for concrete Item subclass CubicalBackgroundSource: "a cubical background source with an anisotropic inward radiation field".

Member Function Documentation

◆ edgeLength()

double CubicalBackgroundSource::edgeLength ( ) const
inline

This function returns the value of the discoverable double property edgeLength: "the edge length of the background cube".

This property represents a physical quantity of type "length".

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

◆ intrinsicDimension()

int CubicalBackgroundSource::intrinsicDimension ( ) const
overridevirtual

This function returns the intrinsic dimension of the geometry, which is 3 in this case.

Implements CenteredSource.

◆ launchSpecialty()

void CubicalBackgroundSource::launchSpecialty ( PhotonPacket * pp,
size_t historyIndex,
double lambda,
double Lw,
VelocityInterface * bvi ) const
overridevirtual

This function causes the photon packet pp to be launched from the source using the given history index, wavelength, weighted luminosity contribution, and redshift interface (corresponding to the bulk velocity of the source).

Firstly, the function generates a random inward launch position \({\bf{r}}\) on the background surface. To accomplish this, it randomly selects one of the six cube walls (represented by its outward normal \({\bf{u}}\)), generates a random position within the selected wall, and transforms this position to take into account the background cube's size and center position.

Secondly, the function generates a random direction \({\bf{k}}\) appropriate for the anisotropic inward radiation field at the location \({\bf{r}}\), or equivalently, for the wall normal \({\bf{u}}\).

In a spherical coordinate system with the Z' axis normal to the surface at the position \({\bf{r}}\), the probability distribution is given by

\[ p(\theta',\varphi')\, {\text{d}}\theta'\, {\text{d}}\varphi' = -\frac{1}{\pi}\cos\theta' \sin\theta'\,{\text{d}}\theta'\, {\text{d}}\varphi' \qquad \frac{\pi}{2} \leq \theta' < \pi. \]

Random angles \(\theta'\) and \(\varphi'\) can be determined by taking two uniform deviates \({\cal{X}}_1\) and \({\cal{X}}_2\) and solving the two equations

\[\begin{split} {\cal{X}}_1 &= -\int_{\pi/2}^{\theta'} 2\sin\theta^{\prime\prime}\cos\theta^{\prime\prime}\,{\text{d}}\theta^{\prime\prime} \\ {\cal{X}}_2 &= \int_0^{\varphi'} \frac{{\text{d}}\varphi^{\prime\prime}}{2\pi} \end{split} \]

for \(\theta'\) and \(\varphi'\). The solution is readily found,

\[ \begin{split} \theta' &= \pi - \arccos \sqrt{{\cal{X}}_1} \\ \varphi' &= 2\pi\,{\cal{X}}_2. \end{split} \]

Once these values have been determined, we need to rotate such that the Z' axis is perpendicular to the wall corresponding to the position \({\bf{r}}\).

Thirdly, the function sets up a thread-local object that serves the angular distribution interface for a particular launch position. Configured with the appropriate launch wall normal \({\bf{u}}\), this object is handed to the photon packet being launched so that peel-off photon packets can retrieve the appropriate bias factor for the instrument direction. This works even if there are multiple sources of this type because each thread handles a single photon packet at a time.

The local angular distribution object implements a function that returns the normalized probability for a direction \({\bf{k}}\), given that the point of emission is defined by the normal \({\bf{u}}\). The appropriate probability distribution is given by

\[p({\bf{k}})\, {\text{d}}\Omega = \begin{cases} 0 & 0 \leq \theta' < \frac{\pi}{2} \\ -4\cos\theta'\, {\text{d}}\Omega & \frac{\pi}{2} \leq \theta' < \pi \end{cases} \]

Here \(\theta'\) is the angle between the direction \({\bf{k}}\) and the outward normal \({\bf{u}}\) of the launch wall, i.e.

\[ \cos\theta' = {\bf{k} \cdot \bf{r}}. \]

This distribution is correctly normalized in the sense that

\[ \frac{1}{4\pi} \iint p({\bf{k}})\, {\text{d}}\Omega = 1. \]

Finally, the function launches the photon packet, passing it all of the above information.

Implements SpecialtySource.


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