The SKIRT project
advanced radiative transfer for astrophysics
LineGasSecondarySource Class Reference

#include <LineGasSecondarySource.hpp>

Inheritance diagram for LineGasSecondarySource:

Public Member Functions

 LineGasSecondarySource (SimulationItem *parent, int h)
void launch (PhotonPacket *pp, size_t historyIndex, double L) const override
double prepareLuminosities () override
void preparePacketMap (size_t firstIndex, size_t numIndices) override
Public Member Functions inherited from SecondarySource
 SecondarySource (SimulationItem *parent)
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

Private Attributes

Array _centers
Configuration_config
int _h
bool _hasTemperature
vector< size_t > _Iv
Array _Lv
Array _masses
const EmittingGasMix_mix
MediumSystem_ms
int _numLines
Random_random
Array _Wv

Additional Inherited Members

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 ()

Detailed Description

LineGasSecondarySource is a helper class that launches secondary emission photon packets from emission lines for a given gas medium component. An instance of this class should be constructed only if secondary emission from gas is enabled for the simulation.

For more information on the operation of this class, see the SecondarySourceSystem class.

Constructor & Destructor Documentation

◆ LineGasSecondarySource()

LineGasSecondarySource::LineGasSecondarySource ( SimulationItem * parent,
int h )
explicit

This constructor creates a LineGasSecondarySource instance for the medium component with the specified index. This medium component must have a material mix that derives from the abstract EmittingGasMix class. Before the constructor returns, the newly created object is hooked up as a child to the specified parent in the simulation hierarchy (so it will automatically be deleted).

Member Function Documentation

◆ launch()

void LineGasSecondarySource::launch ( PhotonPacket * pp,
size_t historyIndex,
double L ) const
overridevirtual

This function causes the photon packet pp to be launched from one of the cells in the spatial grid using the given history index. Because photon packets launched from a given spatial cell are usually handled consecutively by the same execution thread, this function can and does calculate the line luminosities for a given cell only once. It preserves the relevant information from one invocation of the function to the next in a helper object allocated with thread-local storage scope. As a result, memory requirements are limited to storing the information for only a single cell per execution thread, and the calculation is still performed only once per cell.

Once the line luminosities for the current cell are known, the function randomly selects one of the central line wavelengths from the discrete distribution represented by the line luminosities and/or from a uniform distribution as governed by the configured wavelength bias fraction (the configured bias wavelength distribution is ignored), adjusting the launch weight appropriately.

The selected central line wavelength is adjusted with a random Doppler shift corresponding to the thermal motion of the particle emitting that line. The particle velocity is drawn from a Maxwell-Boltzman distribution parametrized by the temperature of the medium in the emitting cell (obtained from the medium state) and the mass of the emitting particle (obtained from the emitting material mix). If the temperature is zero or unavailable, or if the particle mass is zero, no thermal Doppler shift is added. The function further obtains the bulk velocity of the cell and applies the corresponding macroscopic Doppler shift. Other than this, the emission is assumed to be unpolarized and isotropic in the comoving frame.

The function then generates a random position uniformly within the spatial cell.

Finally, the function actually initializes the photon packet with this information.

Implements SecondarySource.

◆ prepareLuminosities()

double LineGasSecondarySource::prepareLuminosities ( )
overridevirtual

This function calculates and stores the bolometric luminosities for this source in each spatial cell of the simulation, and returns the total bolometric luminosity.

Implements SecondarySource.

◆ preparePacketMap()

void LineGasSecondarySource::preparePacketMap ( size_t firstIndex,
size_t numIndices )
overridevirtual

This function prepares the mapping of history indices to spatial cells, given the range of history indices allocated to this source.

Implements SecondarySource.


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