The SKIRT project
advanced radiative transfer for astrophysics
ShellGeometry Class Reference

#include <ShellGeometry.hpp>

Inheritance diagram for ShellGeometry:

Public Member Functions

double density (double r) const override
double exponent () const
double maxRadius () const
double minRadius () const
double randomRadius () const override
double Sigmar () const override
Public Member Functions inherited from SpheGeometry
double density (Position bfr) const override
int dimension () const override
Position generatePosition () const override
double SigmaX () const override
double SigmaY () const override
double SigmaZ () const override
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

Protected Member Functions

 ShellGeometry ()
void setupSelfBefore () override
Protected Member Functions inherited from SpheGeometry
 SpheGeometry ()
Protected Member Functions inherited from Geometry
 Geometry ()
Randomrandom () const
Protected Member Functions inherited from SimulationItem
 SimulationItem ()
virtual bool offersInterface (const std::type_info &interfaceTypeInfo) const
virtual void setupSelfAfter ()
Protected Member Functions inherited from Item
 Item ()

Private Types

using BaseType
using ItemType

Private Attributes

double _A
double _exponent
double _maxRadius
double _minRadius
const double & _p
const double & _rmax
const double & _rmin
double _sdiff
double _smin
double _tmax
double _tmin

Friends

class ItemRegistry

Detailed Description

The ShellGeometry class is a subclass of the SpheGeometry class and describes the geometry of a spherical shell, where the density behaves as a power law between an inner and an outer radius,

\[ \rho(r) = A\,r^{-p} \qquad\qquad r_{\text{min}} < r < r_{\text{max}}. \]

with \(A\) a normalization constant. Obviously the condition \(r_{\text{min}} < r_{\text{max}}\) should be satisfied. This geometry is characterized by three free parameters: the inner radius \(r_{\text{min}}\), the outer radius \(r_{\text{max}}\) and the power law exponent \(p\).

Constructor & Destructor Documentation

◆ ShellGeometry()

ShellGeometry::ShellGeometry ( )
inlineprotected

Default constructor for concrete Item subclass ShellGeometry: "a shell geometry".

Member Function Documentation

◆ density()

double ShellGeometry::density ( double r) const
overridevirtual

This function returns the density \(\rho(r)\) at the radius \(r\). It just implements the analytical formula.

Implements SpheGeometry.

◆ exponent()

double ShellGeometry::exponent ( ) const
inline

This function returns the value of the discoverable double property exponent: "the power law exponent".

◆ maxRadius()

double ShellGeometry::maxRadius ( ) const
inline

This function returns the value of the discoverable double property maxRadius: "the outer radius of the shell".

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

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

◆ minRadius()

double ShellGeometry::minRadius ( ) const
inline

This function returns the value of the discoverable double property minRadius: "the inner radius of the shell".

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

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

◆ randomRadius()

double ShellGeometry::randomRadius ( ) const
overridevirtual

This function returns the radius of a random position drawn from the shell density distribution. This is accomplished by generating a uniform deviate \({\cal{X}}\), and solving the equation

\[ {\cal{X}} = M(r) = 4\pi \int_0^r \rho(r')\, r'{}^2\, {\text{d}}r' \]

for \(r\). For the shell geometry, with \(p\ne3\), we find

\[ {\cal{X}} = \frac{r^{3-p}-r_{\text{min}}^{3-p}} {r_{\text{max}}^{3-p}-r_{\text{min}}^{3-p}}. \]

Inverting this results in

\[ r = \left[ (1-{\cal{X}})\,r_{\text{min}}^{3-p} + {\cal{X}}\,r_{\text{max}}^{3-p} \right]^{\frac{1}{3-p}}. \]

For \(p=3\) this expression does not hold, and for \(p\approx3\) it breaks down numerically. So for \(p\approx3\) we can write the general expression

\[ r = {\text{gexp}}_{p-2} \Big[ {\text{gln}}_{p-2}\, r_{\text{min}} + {\cal{X}}\,( {\text{gln}}_{p-2}\, r_{\text{max}} - {\text{gln}}_{p-2}\, r_{\text{min}} ) \Bigr]. \]

In this expression, \({\text{gln}}_p\,x\) and \({\text{gexp}}_p\,x\) are the generalized logarithm and exponential functions defined in SpecialFunctions::gln and SpecialFunctions::gexp respectively.

Implements SpheGeometry.

◆ setupSelfBefore()

void ShellGeometry::setupSelfBefore ( )
overrideprotectedvirtual

This function verifies the validity of the attributes. The normalization parameter \(A\) is set by the normalization condition that total mass equals one, i.e.

\[ 1 = 4\pi A \int_{r_{\text{min}}}^{r_{\text{max}}} r^{2-p}\, {\text{d}}r. \]

This results in

\[ A = \frac{1}{4\pi}\, \frac{1}{ {\text{gln}}_{p-2}\, r_{\text{max}} - {\text{gln}}_{p-2}\, r_{\text{min}} }, \]

with \({\text{gln}}_p\,x\) the generalized logarithm defined in SpecialFunctions::gln.

Reimplemented from Geometry.

◆ Sigmar()

double ShellGeometry::Sigmar ( ) const
overridevirtual

This function returns the radial surface density, i.e. the integration of the density along a line starting at the centre of the coordinate system,

\[ \Sigma_r = \int_0^\infty \rho(r)\,{\text{d}}r. \]

For the shell geometry, one obtains

\[ \Sigma_r = A\, ( {\text{gln}}_p\, r_{\text{max}} - {\text{gln}}_p\, r_{\text{min}} ) \]

with \({\text{gln}}_p\,x\) the generalized logarithm defined in SpecialFunctions::gln.

Implements SpheGeometry.


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