#include <DustMix.hpp>
Public Types | |
enum class | ScatteringMode { HenyeyGreenstein , MaterialPhaseFunction , SphericalPolarization , SpheroidalPolarization } |
![]() | |
enum class | DynamicStateType { None , Primary , Secondary , PrimaryIfMergedIterations } |
enum class | MaterialType { Dust , Electrons , Gas } |
Public Member Functions | |
double | asymmpar (double lambda) const override |
Array | emissionSpectrum (const MaterialState *state, const Array &Jv) const override |
DisjointWavelengthGrid * | emissionWavelengthGrid () 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 Array & | sectionsAbs (double lambda) const override |
const Array & | sectionsAbspol (double lambda) const override |
double | sectionSca (double lambda) const override |
vector< StateVariable > | specificStateVariableInfo () const override |
const Array & | thetaGrid () const override |
![]() | |
virtual double | asymmpar (double lambda) const |
virtual Array | emissionSpectrum (const MaterialState *state, const Array &Jv) const |
virtual DisjointWavelengthGrid * | emissionWavelengthGrid () 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 ¶ms) 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< SnapshotParameter > | parameterInfo () 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 Array & | sectionsAbs (double lambda) const |
virtual const Array & | sectionsAbspol (double lambda) const |
virtual double | sectionSca (double lambda) const =0 |
virtual vector< StateVariable > | specificStateVariableInfo () const =0 |
virtual const Array & | thetaGrid () const |
virtual UpdateStatus | updateSpecificState (MaterialState *state, const Array &Jv) const |
![]() | |
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 |
![]() | |
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 |
Protected Member Functions | |
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 |
![]() | |
MaterialMix () | |
Configuration * | config () const |
Random * | random () const |
void | setupSelfBefore () override |
![]() | |
SimulationItem () | |
virtual bool | offersInterface (const std::type_info &interfaceTypeInfo) const |
virtual void | setupSelfAfter () |
virtual void | setupSelfBefore () |
![]() | |
Item () | |
Private Types | |
using | BaseType = MaterialMix |
using | ItemType = DustMix |
Private Member Functions | |
void | applyMueller (double lambda, double theta, StokesVector *sv) const |
std::pair< double, double > | generateAnglesFromPhaseFunction (double lambda, const StokesVector *sv) const |
double | generateCosineFromPhaseFunction (double lambda) const |
int | indexForLambda (double lambda) const |
int | indexForTheta (double theta) const |
double | phaseFunctionValue (double lambda, double theta, double phi, const StokesVector *sv) const |
double | phaseFunctionValueForCosine (double lambda, double costheta) const |
Private Attributes | |
Array | _asymmparv |
EquilibriumDustEmissionCalculator | _calc |
Array | _lambdav |
double | _mu |
Array | _pfnormv |
Array | _phi1v |
Array | _phicv |
Array | _phisv |
Array | _phiv |
Range | _required |
Table< 2 > | _S11vv |
Table< 2 > | _S12vv |
Table< 2 > | _S33vv |
Table< 2 > | _S34vv |
ArrayTable< 2 > | _sigmaabspolvv |
Array | _sigmaabsv |
ArrayTable< 2 > | _sigmaabsvv |
Array | _sigmaextv |
Array | _sigmascav |
Array | _thetav |
ArrayTable< 2 > | _thetaXvv |
Friends | |
class | ItemRegistry |
DustMix is the abstract base class for all classes representing the material properties of a dust medium. It implements the complete abstract interface defined by the MaterialMix base class for obtaining optical material properties. Depending on the scattering mode returned by the scatteringMode() function (which must be overridden by subclasses that support a scattering mode other than HenyeyGreenstein), the DustMix setup machinery requests the relevant optical dust properties from the subclass, and caches this information (possibly with some additional precalculated data) for later use. During the simulation, these properties can then be served up without further access to the subclass.
In all cases, the properties served through the MaterialMix base class interface correspond to the properties of a single grain population that is representative for the complete dust mix. For dust mixes described by multiple grain populations, the optical properties should be integrated over the grain size distribution and accumulated across all grain populations. In the context of tracking photon paths through a dusty medium, using these integrated absorption and scattering cross sections and Mueller matrix coefficients is mathematically exact. In other words, for scattering modes MaterialPhaseFunction and SphericalPolarization, the representative grain approach does not involve an approximation. However, the calculation of a representative scattering asymmetry parameter
The representative grain properties offered 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. Again, refer to the description of the MultiGrainDustMix class for more information.
The implementation of polarization by scattering in this class is based on the analysis presented by Peest at al. 2017 (A&A, 601, A92).
Extreme forward (or backward) Henyey-Greenstein scattering
In the X-ray wavelength range, dust grains exhibit extreme forward scattering with asymmetry parameter
More annoyingly, the bias weights for scattering peel-off photon packets can become very large, causing unacceptably high noise levels in the fluxes recorded by instruments. Consider the HG phase function,
Given the angle
To address this situation, we average the peel-off bias weight for a photon packet sent to an instrument over a portion of the phase function, as opposed to taking the value at a given angle. This introduces a certain amount of blur in recorded fluxes, while simultaneously decreasing the level of noise. The effect is reminiscent of that of an actual instrument's point spread function.
We introduce the notation
with
We similarly use
We further denote the half-opening angle of the instrument's solid angle as
The last two expressions are needed to handle the cases where the averaging interval straddles zero or
Investigation of these expressions shows that a half-opening angle of
|
strong |
This enumeration lists the scattering modes supported by the dust mix hierarchy.
|
inlineprotected |
|
private |
This function is used with the SphericalPolarization scattering mode. It applies the Mueller matrix transformation for the specified wavelength
For scattering by spherical grains, the Mueller matrix has only four independent coefficients, namely
|
overridevirtual |
This function returns the scattering asymmetry parameter
Reimplemented from MaterialMix.
|
overridevirtual |
This function returns the emission spectrum (radiated power per unit of solid angle) in the spatial cell and medium component represented by the specified material state and the receiving material mix when it would be embedded in the specified radiation field. For a dust mix, it returns the result of the emissivity() function multiplied by the hydrogen number density retrieved from the material state.
Reimplemented from MaterialMix.
|
overridevirtual |
This function returns the wavelength grid on which dust emission is discretized, i.e. the wavelength grid returned by the Configuration::dustEmissionWLG() function.
Reimplemented from MaterialMix.
This function returns the emissivity spectrum
The equilibrium emissivity of a representative grain population in an embedding radiation field
with
The behavior of this function is undefined if the simulation does not track the radiation field, because in that case setup does not calculate the information on which this function relies.
Reimplemented from MaterialMix.
Reimplemented in MultiGrainDustMix.
|
private |
This function is used with the SphericalPolarization scattering mode. It generates random scattering angles
For scattering by spherical grains, we sample from the phase function listed for the phaseFunctionValue() function using the conditional probability technique. We reduce the phase function to the marginal distribution
We sample a random
for
Once we have selected a random scattering angle
where the ratio
This can again be done through numerical inversion, by solving the equation
for
|
private |
This function is used with the MaterialPhaseFunction scattering mode, which assumes that the scattering phase function depends only on the cosine of the scattering angle. The function generates a random scattering angle cosine sampled from the phase function
The phase function for unpolarized radiation is obtained from the general polarized case described for the phaseFunctionValue() function by setting the linear polarization degree
|
protectedpure virtual |
This function must be implemented in each subclass to obtain the representative grain optical properties for the dust mix. Although the function arguments provide for all properties that may be required, the list of actually required properties for a particular subclass depends on the scattering mode advertised by the scatteringMode() function.
The first two arguments respectively specify the wavelength grid and (if applicable) the scattering angle grid on which the properties must be tabulated. The function must store the absorption and scattering cross sections and the asymmetry parameter into the three subsequent output arrays, and the Mueller coefficients into the four subsequent output tables (indexed on wavelength and angle in that order). These arrays and tables will already have the appropriate size (corresponding to the input wavelength grids) when the function gets called. Finally, the function must return the dust mass per hydrogen atom for the dust mix.
For the HenyeyGreenstein scattering mode, the function must output the cross sections and the asymmetry parameter, and it must leave the Mueller coeficient tables untouched. For scattering modes other than HenyeyGreenstein, the asymmetry parameter output array may be filled with "relevant" values (not used for calculations but possibly exposed to the user through a Probe), or it may be left untouched. For the SphericalPolarization scattering mode, the function must fill all four Mueller coeficient tables. For the MaterialPhaseFunction scattering mode, the function must fill only the first table and it must leave the other tables untouched.
For the SpheroidalPolarization mode, the function must also fill the sigmaabsvv and sigmaabspolvv tables.
Implemented in MultiGrainDustMix, SingleGrainDustMix, and TabulatedDustMix.
|
overridevirtual |
This function returns true for this class because all dust mixes support secondary continuum emission.
Reimplemented from MaterialMix.
|
private |
This function returns the index in the private wavelength grid corresponding to the specified wavelength. The parameters for converting a wavelength to the appropriate index are stored in data members during setup.
|
private |
This function returns the index in the private scattering angle grid corresponding to the specified scattering angle. The parameters for converting a scattering angle to the appropriate index are built-in constants.
|
overridevirtual |
This function returns an indicative temperature of the material mix when it would be embedded in a given radiation field. For dust mixes, it returns the equilibrium temperature
The equilibrium temperature is obtained from the energy balance equation,
where the left-hand side is integrated over the radiation field wavelength grid, and the right-hand side is precalculated during setup for a range of temperatures through integration over a built-in wavelength grid.
Reimplemented from MaterialMix.
|
protected |
This function logs a warning message if the given range is smaller than the simulation wavelength range. It can (but does not have to) be called from subclasses that support dust properties for a limited wavelength range.
|
protectedvirtual |
This function can be implemented in a subclass to initialize dust properties that are required to offer additional functionality. 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 is called by the DustMix class during setup after the getOpticalProperties() function has been called and its results have been processed. The function returns the number of bytes allocated by the subclass to support the extra features (this number is used for logging purposes). The default implementation of this function does nothing and returns zero.
Reimplemented in MultiGrainDustMix.
|
overridevirtual |
This function returns the dust mass
Implements MaterialMix.
|
overridevirtual |
This function returns the fundamental material type represented by this material mix, in other words it returns MaterialType::Dust.
Implements MaterialMix.
|
overridevirtual |
This function returns the absorption opacity
Implements MaterialMix.
|
overridevirtual |
This function returns the extinction opacity
Implements MaterialMix.
|
overridevirtual |
This function returns the scattering opacity
Implements MaterialMix.
|
overridevirtual |
This function calculates the contribution of the medium component associated with this material mix to the peel-off photon luminosity, polarization state, and wavelength shift for the given wavelength, geometry, material state, and photon properties. The contributions to the Stokes vector components are stored in the I, Q, U, V arguments, which are guaranteed to be initialized to zero by the caller. For dust mixes, the wavelength remains unchanged.
Evaluation of the phase function depends on the scattering mode supported by supported by the dust mix, as defined by each subclass. For the most basic mode, the material mix provides a value for the scattering asymmetry parameter
For other scattering modes, the phase function provided by the material mix is invoked instead.
In case polarization is supported in the current simulation configuration, the polarization state of the peel off photon packet is adjusted as well. The adjusted Stokes vector for a particular medium component is obtained as follows. The function rotates the Stokes vector from the reference direction in the previous scattering plane into the peel-off scattering plane, applies the Mueller matrix on the Stokes vector, and further rotates the Stokes vector from the reference direction in the peel-off scattering plane to the x-axis of the instrument to which the peel-off photon packet is headed.
Implements MaterialMix.
|
overridevirtual |
This function performs a scattering event on the specified photon packet in the spatial cell and medium component represented by the specified material state and the receiving material mix.
For dust mixes, the operation depends on the scattering mode supported by the dust mix, as defined by each subclass. For the most basic mode, the dust mix provides a value for the scattering asymmetry parameter
This can be accomplished as follows. Substituting
We can use the transformation method to sample from this distribution. Given a uniform deviate
Performing the integration and solving for
For other scattering modes, a function provided by the dust mix is invoked instead to obtain a random scattering direction for the photon packet.
In case polarization is supported in the current simulation configuration, the polarization state of the photon packet is adjusted as well. Note that all media must either support polarization or not support it, mixing these support levels is not allowed. Compliance with this requirement is verified during setup of the simulation. The adjusted Stokes vector is obtained as follows, again using the randomly selected medium component. After obtaining the sampled scattering angles
Implements MaterialMix.
|
private |
This function is used with the SphericalPolarization scattering mode. It returns the value of the scattering phase function
The phase function for scattering by spherical grains can be written as
with
where
|
private |
This function is used with the MaterialPhaseFunction scattering mode, which assumes that the scattering phase function depends only on the cosine of the scattering angle. The function returns the value of the scattering phase function
The phase function for unpolarized radiation is obtained from the general polarized case described for the phaseFunctionValue() function by setting the linear polarization degree
|
virtual |
This function returns the scattering mode supported by this dust mix. In the current implementation, this can be one of the following modes:
The implementation of this function in this base class returns the HenyeyGreenstein scattering mode as a default value. Subclasses that support another scattering mode must override this function and return the appropriate value.
Reimplemented in ConfigurableDustMix, DustMixFragment, MeanPinteBenchmarkDustMix, and MeanTrustBenchmarkDustMix.
|
overridevirtual |
This function returns the absorption cross section per entity
Implements MaterialMix.
|
overridevirtual |
This function returns the total extinction cross section per entity
Implements MaterialMix.
|
overridevirtual |
This function is intended for use with the SpheroidalPolarization mode. It returns the absorption cross sections per entity
Reimplemented from MaterialMix.
|
overridevirtual |
This function is intended for use with the SpheroidalPolarization mode. It returns the linear polarization absorption cross sections per entity
Reimplemented from MaterialMix.
|
overridevirtual |
This function returns the scattering cross section per entity
Implements MaterialMix.
|
overrideprotectedvirtual |
This function obtains and/or precalculates information used to serve optical properties for the dust mix to the simulation.
First, it obtains the optical properties of the dust mix from the subclass on a wavelength grid with a range spanning all wavelengths in the simulation, and with sufficient resolution so that no further interpolation is needed. This includes the absorption and scattering cross sections, the scattering asymmetry parameter, and/or the Mueller matrix coefficients as required by the implemented scattering mode.
If the simulation wavelength range extends beyond 10 cm, it is cut off at that value and any dust cross sections beyond 10 cm are forced to zero. None of the currently provided dust mixes offers optical properties beyond 10 cm, and historically any values outside the supported range are clamped to the nearest available value. This leads to substantially overestimated dust extinction in the radio wavelength range. Hence this "hack".
Furthermore, if the simulation tracks the radiation field, this function precalculates the Planck-integrated absorption cross sections on an appropriate temperature grid. This information is used to obtain the equilibrium temperature of the material mix (or rather, of its representative grain population) in a given embedding radiation field.
Reimplemented from SimulationItem.
Reimplemented in DustMixFragment.
|
overridevirtual |
This function returns a list of StateVariable objects describing the specific state variables used by the receiving material mix. See the description of the MaterialMix::specificStateVariableInfo() function for more information.
Dust mixes require just the standard specific state variable of type numberDensity , so this function returns a list containing a single item.
Implements MaterialMix.
|
overridevirtual |
This function is intended for use with the SpheroidalPolarization mode. It returns the grid used for discretizing quantities that are a function of the scattering/emission angle
Reimplemented from MaterialMix.