#include <SphericalBackgroundSource.hpp>
Public Member Functions | |
double | backgroundRadius () 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 |
virtual int | intrinsicDimension () const =0 |
Public Member Functions inherited from SpecialtySource | |
int | dimension () const override |
virtual int | geometryDimension () const =0 |
bool | hasVelocity () const override |
void | launchNormalized (PhotonPacket *pp, size_t historyIndex, double lambda, double Lw) const override |
virtual void | launchSpecialty (PhotonPacket *pp, size_t historyIndex, double lambda, double Lw, VelocityInterface *bvi) const =0 |
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 |
virtual void | launchNormalized (PhotonPacket *pp, size_t historyIndex, double lambda, double Lw) const =0 |
double | luminosity () const override |
LuminosityNormalization * | normalization () const |
SED * | sed () const |
double | specificLuminosity (double wavelength) const override |
Range | wavelengthRange () const override |
Public Member Functions inherited from Source | |
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 |
WavelengthDistribution * | wavelengthBiasDistribution () 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 Item * | getItemProperty (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) |
Item & | operator= (const Item &)=delete |
Item * | parent () 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 |
Public Member Functions inherited from VelocityInterface | |
virtual | ~VelocityInterface () |
virtual Vec | velocity () const =0 |
Protected Member Functions | |
SphericalBackgroundSource () | |
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 |
void | setupSelfBefore () override |
Protected Member Functions inherited from Source | |
Source () | |
void | informAvailableWavelengthRange (Range available, string itemType) |
Random * | random () const |
void | setupSelfBefore () override |
Protected Member Functions inherited from SimulationItem | |
SimulationItem () | |
virtual bool | offersInterface (const std::type_info &interfaceTypeInfo) const |
virtual void | setupSelfAfter () |
virtual void | setupSelfBefore () |
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 = CenteredSource |
using | ItemType = SphericalBackgroundSource |
Private Attributes | |
double | _backgroundRadius |
Friends | |
class | ItemRegistry |
The SphericalBackgroundSource class represents the surface of a sphere of radius \(r_{\text{bg}}\) from which radiation escapes in the inward direction. The emissivity of this source is anisotropic. There is no radiation outwards and the intensity is proportional to \(\cos\theta'\) in the inward hemisphere, where \(\theta'\) is the angle between the direction and the normal on the surface.
|
inlineprotected |
Default constructor for concrete Item subclass SphericalBackgroundSource : "a spherical background source with an anisotropic inward radiation field" .
|
inline |
This function returns the value of the discoverable double property backgroundRadius : "the radius of the background sphere" .
This property represents a physical quantity of type "length" .
The minimum value for this property is "]0" .
|
overridevirtual |
This function returns the intrinsic dimension of the geometry, which is 1 in this case: the geometry is spherically symmetric, even with the anisotropic emissivity.
Implements CenteredSource.
|
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 by drawing a random direction \({\bf{u}}\) on the unit sphere and transforming it to take into account the background radius and center position. The direction \({\bf{u}}\) actually corresponds to the outward normal to the background surface at the position \({\bf{r}}\).
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 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 determine the coordinates of the vector \({\bf{k}}\) in the standard coordinate system. The link between the standard XYZ coordinate system and the one with the Z' axis determined by the normal \({\bf{u}}\) is a joint rotation over an angle \(\varphi\) along the Z-axis, followed by a rotation over an angle \(\theta\) over the Y'-axis, where \(\theta\) and \(\varphi\) are the polar angle and azimuth of the position vector \({\bf{r}}\). The connection is hence
\[ \begin{bmatrix} k'_x \\ k'_y \\ k'_z \end{bmatrix} = \begin{bmatrix} \cos\theta & 0 & -\sin\theta \\ 0 & 1 & 0 \\ \sin\theta & 0 & \cos\theta \end{bmatrix} \begin{bmatrix} \cos\phi & \sin\phi & 0 \\ -\sin\phi & \cos\phi & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} k_x \\ k_y \\ k_z \end{bmatrix} \]
or in the other direction
\[ \begin{bmatrix} k_x \\ k_y \\ k_z \end{bmatrix} = \begin{bmatrix} \cos\phi & -\sin\phi & 0 \\ \sin\phi & \cos\phi & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} \cos\theta & 0 & \sin\theta \\ 0 & 1 & 0 \\ -\sin\theta & 0 & \cos\theta \end{bmatrix} \begin{bmatrix} k'_x \\ k'_y \\ k'_z \end{bmatrix} \]
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 position \({\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}}\) on the stellar surface, 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.