The SKIRT project
advanced radiative transfer for astrophysics
Public Member Functions | Protected Member Functions | Private Types | Private Attributes | Friends | List of all members
MultiGrainDustMix Class Reference

#include <MultiGrainDustMix.hpp>

Inheritance diagram for MultiGrainDustMix:
Inheritance graph
[legend]

Public Member Functions

Array emissivity (const Array &Jv) const override
 
bool hasStochasticDustEmission () const override
 
int numPopulations () const override
 
const GrainPopulationpopulation (int c) const
 
double populationBulkDensity (int c) const override
 
string populationGrainType (int c) const override
 
double populationMass (int c) const override
 
double populationNormalization (int c) const
 
const GrainSizeDistributionpopulationSizeDistribution (int c) const override
 
Range populationSizeRange (int c) const override
 
double totalMass () const override
 
- Public Member Functions inherited from DustMix
double asymmpar (double lambda) const override
 
Array emissionSpectrum (const MaterialState *state, const Array &Jv) const override
 
DisjointWavelengthGridemissionWavelengthGrid () const override
 
Array emissivity (const Array &Jv) const override
 
bool hasContinuumEmission () const override
 
double indicativeTemperature (const MaterialState *state, const Array &Jv) const override
 
double mass () const override
 
MaterialType materialType () const override
 
double opacityAbs (double lambda, const MaterialState *state, const PhotonPacket *pp) const override
 
double opacityExt (double lambda, const MaterialState *state, const PhotonPacket *pp) const override
 
double opacitySca (double lambda, const MaterialState *state, const PhotonPacket *pp) const override
 
void peeloffScattering (double &I, double &Q, double &U, double &V, double &lambda, Direction bfkobs, Direction bfky, const MaterialState *state, const PhotonPacket *pp) const override
 
void performScattering (double lambda, const MaterialState *state, PhotonPacket *pp) const override
 
virtual ScatteringMode scatteringMode () const
 
double sectionAbs (double lambda) const override
 
double sectionExt (double lambda) const override
 
const ArraysectionsAbs (double lambda) const override
 
const ArraysectionsAbspol (double lambda) const override
 
double sectionSca (double lambda) const override
 
vector< StateVariablespecificStateVariableInfo () const override
 
const ArraythetaGrid () const override
 
- Public Member Functions inherited from MaterialMix
virtual double asymmpar (double lambda) const
 
virtual Array emissionSpectrum (const MaterialState *state, const Array &Jv) const
 
virtual DisjointWavelengthGridemissionWavelengthGrid () const
 
virtual Array emissivity (const Array &Jv) const
 
virtual bool hasContinuumEmission () const
 
virtual DynamicStateType hasDynamicMediumState () const
 
virtual bool hasExtraSpecificState () const
 
virtual bool hasLineEmission () const
 
virtual bool hasNegativeExtinction () const
 
virtual bool hasPolarizedAbsorption () const
 
virtual bool hasPolarizedEmission () const
 
virtual bool hasPolarizedScattering () const
 
virtual bool hasResonantScattering () const
 
virtual bool hasScatteringDispersion () const
 
virtual bool hasStochasticDustEmission () const
 
virtual double indicativeTemperature (const MaterialState *state, const Array &Jv) const
 
virtual void initializeSpecificState (MaterialState *state, double metallicity, double temperature, const Array &params) const
 
bool isDust () const
 
bool isElectrons () const
 
bool isGas () const
 
virtual bool isSpecificStateConverged (int numCells, int numUpdated, int numNotConverged, MaterialState *currentAggregate, MaterialState *previousAggregate) const
 
virtual Array lineEmissionCenters () const
 
virtual Array lineEmissionMasses () const
 
virtual Array lineEmissionSpectrum (const MaterialState *state, const Array &Jv) const
 
virtual double mass () const =0
 
virtual MaterialType materialType () const =0
 
virtual double opacityAbs (double lambda, const MaterialState *state, const PhotonPacket *pp) const =0
 
virtual double opacityExt (double lambda, const MaterialState *state, const PhotonPacket *pp) const =0
 
virtual double opacitySca (double lambda, const MaterialState *state, const PhotonPacket *pp) const =0
 
virtual vector< SnapshotParameterparameterInfo () const
 
virtual void peeloffScattering (double &I, double &Q, double &U, double &V, double &lambda, Direction bfkobs, Direction bfky, const MaterialState *state, const PhotonPacket *pp) const =0
 
virtual void performScattering (double lambda, const MaterialState *state, PhotonPacket *pp) const =0
 
virtual double sectionAbs (double lambda) const =0
 
virtual double sectionExt (double lambda) const =0
 
virtual const ArraysectionsAbs (double lambda) const
 
virtual const ArraysectionsAbspol (double lambda) const
 
virtual double sectionSca (double lambda) const =0
 
virtual vector< StateVariablespecificStateVariableInfo () const =0
 
virtual const ArraythetaGrid () const
 
virtual UpdateStatus updateSpecificState (MaterialState *state, const Array &Jv) 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 MultiGrainPopulationInterface
virtual ~MultiGrainPopulationInterface ()
 
virtual int numPopulations () const =0
 
virtual double populationBulkDensity (int c) const =0
 
virtual string populationGrainType (int c) const =0
 
virtual double populationMass (int c) const =0
 
virtual const GrainSizeDistributionpopulationSizeDistribution (int c) const =0
 
virtual Range populationSizeRange (int c) const =0
 
virtual double totalMass () const =0
 

Protected Member Functions

 MultiGrainDustMix ()
 
void addPopulation (const GrainPopulation *population)
 
void addPopulation (GrainComposition *composition, GrainSizeDistribution *sizeDistribution, int numSizes, GrainPopulation::NormalizationType normType, double normValue)
 
double getOpticalProperties (const Array &lambdav, const Array &thetav, Array &sigmaabsv, Array &sigmascav, Array &asymmparv, Table< 2 > &S11vv, Table< 2 > &S12vv, Table< 2 > &S33vv, Table< 2 > &S34vv, ArrayTable< 2 > &sigmaabsvv, ArrayTable< 2 > &sigmaabspolvv) override
 
size_t initializeExtraProperties (const Array &lambdav) override
 
- Protected Member Functions inherited from DustMix
 DustMix ()
 
virtual double getOpticalProperties (const Array &lambdav, const Array &thetav, Array &sigmaabsv, Array &sigmascav, Array &asymmparv, Table< 2 > &S11vv, Table< 2 > &S12vv, Table< 2 > &S33vv, Table< 2 > &S34vv, ArrayTable< 2 > &sigmaabsvv, ArrayTable< 2 > &sigmaabspolvv)=0
 
void informAvailableWavelengthRange (Range available)
 
virtual size_t initializeExtraProperties (const Array &lambdav)
 
void setupSelfAfter () override
 
- Protected Member Functions inherited from MaterialMix
 MaterialMix ()
 
Configurationconfig () const
 
Randomrandom () 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 MultiGrainPopulationInterface
 MultiGrainPopulationInterface ()
 

Private Types

using BaseType = DustMix
 
using ItemType = MultiGrainDustMix
 

Private Attributes

EquilibriumDustEmissionCalculator _calcEq
 
StochasticDustEmissionCalculator _calcSt
 
bool _multigrain
 
vector< double > _mupopv
 
vector< double > _normv
 
vector< const GrainPopulation * > _populations
 
bool _stochastic
 

Friends

class ItemRegistry
 

Additional Inherited Members

- Public Types inherited from DustMix
enum class  ScatteringMode { HenyeyGreenstein , MaterialPhaseFunction , SphericalPolarization , SpheroidalPolarization }
 
- Public Types inherited from MaterialMix
enum class  DynamicStateType { None , Primary , Secondary , PrimaryIfMergedIterations }
 
enum class  MaterialType { Dust , Electrons , Gas }
 

Detailed Description

MultiGrainDustMix is an abstract class implementing a dust mix described by one or more grain populations, each with their own grain composition and size distribution, and with or without support for polarization by scattering. The class offers facilities to its subclasses to add dust grain populations to the dust mix during initial setup. Subsequently, the class uses this list of grain populations to calculate the optical properties requested by the DustMix base class, and to implement the additional functionality offered by multi-grain-population dust mixes, such as calculating emission from stochastically heated dust grains.

All grain populations added by the subclass must have a level of Mueller matrix support that matches the value returned by the scatteringMode() function (which may be overridden in the subclass). Specifically, for the HenyeyGreenstein scattering mode, none of the grain populations should offer a Mueller matrix. For the MaterialPhaseFunction and SphericalPolarization scattering modes, all of the grain populations should offer a Mueller matrix. If this is not the case, a fatal error will result.

Calculating representative grain properties

The getOpticalProperties() function calculates the basic representative grain properties expected by the DustMix base class from the following information obtained from the dust grain populations added by the subclass: the absorption efficiencies \(Q^{\text{abs}}(\lambda,a)\), the scattering efficiencies \(Q^{\text{sca}}(\lambda,a)\), the scattering phase function asymmetry parameter \(g(\lambda,a)\), the Mueller matrix coefficients \(S^\text{xx}(\lambda,a,\theta)\), the bulk density \(\rho_{\text{bulk}}\) of the grain material, and the properly normalized grain size distribution per hydrogen atom \(\Omega(a)=(\frac{\text{d}n_\text{D}}{\text{d}a})/n_\text{H}\) in the range \([a_\text{min},a_\text{max}]\).

The properties are calculated for each wavelength \(\lambda_\ell\) in the wavelength grid specified by the DustMix class. The values are obtained by integrating over the grain size distribution \(\Omega(a)\) using a builtin logarithmic grid and accumulating over all grain populations \(c\), using the formulas listed below.

The absorption and scattering cross sections per hydrogen atom \(\varsigma_{\ell}^{\text{abs}}\) and \(\varsigma_{\ell}^{\text{abs}}\) for the \(\ell\)'th wavelength are calculated using

\[ \varsigma_{\ell}^{\text{abs}} = \sum_c \int_{a_{\text{min},c}}^{a_{\text{max},c}} \Omega_c(a)\, Q^{\text{abs}}_c(\lambda_\ell,a)\, \pi a^2\, {\text{d}}a \]

and

\[ \varsigma_{\ell}^{\text{sca}} = \sum_c \int_{a_{\text{min},c}}^{a_{\text{max},c}} \Omega_c(a)\, Q^{\text{sca}}_c(\lambda_\ell,a)\, \pi a^2\, {\text{d}}a. \]

The Mueller matrix coefficients provided by the grain population are assumed to be expressed as a cross section (in arbitrary units). They are thus integrated over the size distribution without again multiplying by the grain cross section, i.e. using

\[ S^\text{xx}_{\ell,\text{t}} = \sum_c \int_{a_{\text{min},c}}^{a_{\text{max},c}} \Omega_c(a)\, S^\text{xx}_c(\lambda_\ell,a,\theta_\text{t})\, {\text{d}}a \]

The representative asymmetry parameter \(g_{\ell}\) is averaged over the scattering cross section and thus calculated using

\[ g_{\ell} = \frac{1}{\varsigma_{\ell}^{\text{sca}}} \sum_c \int_{a_{\text{min},c}}^{a_{\text{max},c}} \Omega_c(a)\, g_c(\lambda_\ell,a)\, Q^{\text{sca}}_c(\lambda_\ell,a)\, \pi a^2\, {\text{d}}a. \]

The dust mass per hydrogen atom \(\mu\) is calculated by integrating the bulk density over the size distribution,

\[ \mu = \sum_c \int_{a_{\text{min},c}}^{a_{\text{max},c}} \Omega_c(a)\, \rho_{\text{bulk},c}\, \frac{4\pi}{3}\, a^3\, {\text{d}}a. \]

Calculating dust emission

The representative grain properties described above and offered by the public MaterialMix interface supported by this class are insufficient to accurately calculate dust emission spectra for the dust mixture. This is so because the emission spectrum is a nonlinear function of (among many other things) the grain size, and thus a single grain cannot accurately represent a population with a (potentialy large) range of grain sizes. Furthermore, smaller dust grains are often not in local thermal equilibrium, and instead are heated stochastically by individual photon absorption events. Modeling emission for these grains involves a temperature probability distribution rather than just an equilibrium temperature. The calculation needs calorimetric properties of the grain material in addition to optical properties.

It is numerically intractable to handle every possible grain size seperately. Instead, the MultiGrainDustMix class discretizes the grain size distribution for each type of grain material into a number of consecutive size bins (on a logarithmic scale), and calculates the optical and calorimetric properties of a representative grain for each of these bins. The number of bins for each type of grain material can be configured by the user. A larger number of bins improves the accuracy of the dust emission spectra. On the other hand, the calculation time scales roughly linearly with the number of bins.

The MultiGrainDustMix class uses one of two methods to calculate the emissivity of the dust mix:

Constructor & Destructor Documentation

◆ MultiGrainDustMix()

MultiGrainDustMix::MultiGrainDustMix ( )
inlineprotected

Default constructor for abstract Item subclass MultiGrainDustMix : "a dust mix with one or more grain populations" .

Member Function Documentation

◆ addPopulation() [1/2]

void MultiGrainDustMix::addPopulation ( const GrainPopulation population)
protected

This function adds the specified grain population to the dust mix. The receiving dust mix object retains a pointer to the specified GrainPopulation instance for later reference, but does not take ownership. The caller must ensure that the GrainPopulation instance lives at least as long as the dust mix, and that it is eventually destroyed (at the same time as or later than the dust mix).

◆ addPopulation() [2/2]

void MultiGrainDustMix::addPopulation ( GrainComposition composition,
GrainSizeDistribution sizeDistribution,
int  numSizes,
GrainPopulation::NormalizationType  normType,
double  normValue 
)
protected

This function adds the a grain population to the dust mix specified by its constituent components. The function creates a new GrainPopulation instance, passing its own function arguments to the GrainPopulation constructor. The receiving dust mix object claims ownership of the new GrainPopulation instance. The caller must guarantee that the lifetime of the specified composition and size distribution objects is as least as long as the lifetime of the receiving dust mix.

Refer to the description of the GrainPopulation constructor for more information on the arguments of this function.

◆ emissivity()

Array MultiGrainDustMix::emissivity ( const Array Jv) const
overridevirtual

This function returns the emissivity spectrum \((\varepsilon_\lambda)_\ell\) (radiated power per unit of solid angle and per hydrogen atom) of the dust mix (or rather of the corresponding mixture of representative grain populations) when embedded in the radiation field specified by the mean intensities \((J_\lambda)_k\). The input and output arrays are discretized on the wavelength grids returned by the Configuration::radiationFieldWLG() and Configuration::dustEmissionWLG() functions, repectively.

Depending on the type of emission calculation configured by the user, this function uses an instance of the EquilibriumDustEmissionCalculator or StochasticDustEmissionCalculator to calculate the emission spectrum. Refer to these classes for more information.

The behavior of this function is undefined if the simulation does not track the radiation field, because in that case setup does not precalculate the information on which this function relies.

Reimplemented from DustMix.

◆ getOpticalProperties()

double MultiGrainDustMix::getOpticalProperties ( const Array lambdav,
const Array thetav,
Array sigmaabsv,
Array sigmascav,
Array asymmparv,
Table< 2 > &  S11vv,
Table< 2 > &  S12vv,
Table< 2 > &  S33vv,
Table< 2 > &  S34vv,
ArrayTable< 2 > &  sigmaabsvv,
ArrayTable< 2 > &  sigmaabspolvv 
)
overrideprotectedvirtual

This function is invoked by the DustMix base class to obtain the representative grain optical properties for this dust mix. The first two arguments respectively specify the wavelength grid and (if applicable) the scattering angle grid on which the properties must be tabulated. The output arrays and tables will already have the appropriate size (corresponding to the input wavelength grids) when the function gets called.

For this class, this function integrates the optical properties over the grain size distribution for each of the grain populations added by a subclass as described in the class header, and stores the results into the corresponding output arrays. Also, the function returns the dust mass per hydrogen atom for the dust mix.

For the HenyeyGreenstein scattering mode, the Mueller matric tables remain untouched. For the MaterialPhaseFunction scattering mode, the function fills only the first table and leaves the other tables untouched. For the SphericalPolarization scattering mode, the function fills all four tables.

Implements DustMix.

◆ hasStochasticDustEmission()

bool MultiGrainDustMix::hasStochasticDustEmission ( ) const
overridevirtual

This function returns true, indicating that this dust mix supports stochastic heating of dust grains for the calculation of secondary emission.

Reimplemented from MaterialMix.

◆ initializeExtraProperties()

size_t MultiGrainDustMix::initializeExtraProperties ( const Array lambdav)
overrideprotectedvirtual

This function is invoked by the DustMix base class to precalculate additional dust properties required by this class. The argument specifies the wavelength grid on which the properties may be tabulated (i.e. the same grid as passed to the getOpticalProperties() function. The function returns the number of memory bytes allocated to store extra propertries.

The function discretizes the grain size distribution for each grain population added to this dust mix into a number of consecutive size bins (on a logarithmic scale), and obtains the relevant optical and calorimetric properties of a representative grain for each of these bins. The number of bins for each type of grain material can be configured by the user.

Depending on the type of emission calculation configured by the user, this function creates an instance of the EquilibriumDustEmissionCalculator or StochasticDustEmissionCalculator to store the relevant properties (and to actually calculate the emission spectra when requested).

Reimplemented from DustMix.

◆ numPopulations()

int MultiGrainDustMix::numPopulations ( ) const
overridevirtual

This function returns the number of dust grain populations (with indices \(c\)) added to this dust mix by the subclass. Each grain population represents the combination of a grain composition, providing the optical and calorimetric properties of the grain material, and a grain size distribution with some normalization to specify the the amount of dust contained in the population. No grain size discretization has been applied to these populations.

Implements MultiGrainPopulationInterface.

◆ population()

const GrainPopulation * MultiGrainDustMix::population ( int  c) const

This function returns a read-only pointer to the grain population with index \(c\). It is intended for use by the FragmentDustMixDecorator and should not be used for other purposes.

◆ populationBulkDensity()

double MultiGrainDustMix::populationBulkDensity ( int  c) const
overridevirtual

This function returns the bulk mass density \(\rho_\text{bulk}\) of the grain material represented by the population with index \(c\).

Implements MultiGrainPopulationInterface.

◆ populationGrainType()

string MultiGrainDustMix::populationGrainType ( int  c) const
overridevirtual

This function returns a brief human-readable identifier for the type of grain material represented by the population with index \(c\). The identifier does not contain white space.

Implements MultiGrainPopulationInterface.

◆ populationMass()

double MultiGrainDustMix::populationMass ( int  c) const
overridevirtual

This function returns the dust mass \(\mu_c\) per hydrogen atom for the population with index \(c\).

Implements MultiGrainPopulationInterface.

◆ populationNormalization()

double MultiGrainDustMix::populationNormalization ( int  c) const

This function returns the size distribution normalization factor for the population with index \(c\). It is intended for use by the FragmentDustMixDecorator and should not be used for other purposes.

◆ populationSizeDistribution()

const GrainSizeDistribution * MultiGrainDustMix::populationSizeDistribution ( int  c) const
overridevirtual

This function returns the grain size distribution object for the population with index \(c\).

Implements MultiGrainPopulationInterface.

◆ populationSizeRange()

Range MultiGrainDustMix::populationSizeRange ( int  c) const
overridevirtual

This function returns the minimum and maximum grain sizes \(a_{\text{min},c}, a_{\text{max},c}\) for the population with index \(c\).

Implements MultiGrainPopulationInterface.

◆ totalMass()

double MultiGrainDustMix::totalMass ( ) const
overridevirtual

This function returns the total dust mass \(\mu\) per hydrogen atom for all populations combined.

Implements MultiGrainPopulationInterface.


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