#include <VoronoiMeshMedium.hpp>
Protected Member Functions | |
VoronoiMeshMedium () | |
Snapshot * | createAndOpenSnapshot () override |
VoronoiMeshSnapshot * | voronoiMesh () const override |
Protected Member Functions inherited from MeshMedium | |
MeshMedium () | |
const Box & | domain () const |
void | setupSelfBefore () override |
Protected Member Functions inherited from ImportedMedium | |
ImportedMedium () | |
~ImportedMedium () | |
virtual Snapshot * | createAndOpenSnapshot ()=0 |
void | setupSelfAfter () override |
Protected Member Functions inherited from Medium | |
Medium () | |
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 SiteListInterface | |
SiteListInterface () | |
Protected Member Functions inherited from VoronoiMeshInterface | |
VoronoiMeshInterface () | |
Private Types | |
using | BaseType = MeshMedium |
using | ItemType = VoronoiMeshMedium |
Private Attributes | |
VoronoiMeshSnapshot * | _voronoiMeshSnapshot |
Friends | |
class | ItemRegistry |
Additional Inherited Members | |
Public Types inherited from MeshMedium | |
enum class | MassType : int { MassDensity , Mass , MassDensityAndMass , NumberDensity , Number , NumberDensityAndNumber } |
Public Member Functions inherited from MeshMedium | |
MassType | massType () const |
double | maxX () const |
double | maxY () const |
double | maxZ () const |
double | minX () const |
double | minY () const |
double | minZ () const |
Public Member Functions inherited from ImportedMedium | |
Vec | bulkVelocity (Position bfr) const override |
int | dimension () const override |
string | filename () const |
Position | generatePosition () const override |
bool | hasMagneticField () const override |
bool | hasMetallicity () const override |
bool | hasParameters () const override |
bool | hasTemperature () const override |
bool | hasVariableMix () const override |
bool | hasVelocity () const override |
bool | importMagneticField () const |
bool | importMetallicity () const |
bool | importTemperature () const |
bool | importVariableMixParams () const |
bool | importVelocity () const |
Vec | magneticField (Position bfr) const override |
double | mass () const override |
double | massDensity (Position bfr) const override |
double | massFraction () const |
MaterialMix * | materialMix () const |
MaterialMixFamily * | materialMixFamily () const |
double | maxTemperature () const |
double | metallicity (Position bfr) const override |
const MaterialMix * | mix () const override |
const MaterialMix * | mix (Position bfr) const override |
double | number () const override |
double | numberDensity (Position bfr) const override |
int | numSites () const override |
double | opticalDepthX (double lambda) const override |
double | opticalDepthY (double lambda) const override |
double | opticalDepthZ (double lambda) const override |
void | parameters (Position bfr, Array ¶ms) const override |
Position | sitePosition (int index) const override |
const Snapshot * | snapshot () const |
double | temperature (Position bfr) const override |
string | useColumns () const |
virtual Vec | bulkVelocity (Position bfr) const =0 |
virtual int | dimension () const =0 |
virtual Position | generatePosition () const =0 |
virtual bool | hasMagneticField () const =0 |
virtual bool | hasMetallicity () const =0 |
virtual bool | hasParameters () const =0 |
virtual bool | hasTemperature () const =0 |
virtual bool | hasVariableMix () const =0 |
virtual bool | hasVelocity () const =0 |
virtual Vec | magneticField (Position bfr) const =0 |
virtual double | mass () const =0 |
virtual double | massDensity (Position bfr) const =0 |
virtual double | metallicity (Position bfr) const =0 |
virtual const MaterialMix * | mix () const =0 |
virtual const MaterialMix * | mix (Position bfr) const =0 |
virtual double | number () const =0 |
virtual double | numberDensity (Position bfr) const =0 |
virtual double | opticalDepthX (double lambda) const =0 |
virtual double | opticalDepthY (double lambda) const =0 |
virtual double | opticalDepthZ (double lambda) const =0 |
virtual void | parameters (Position bfr, Array ¶ms) const =0 |
virtual double | temperature (Position bfr) const =0 |
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 SiteListInterface | |
virtual | ~SiteListInterface () |
virtual int | numSites () const =0 |
virtual Position | sitePosition (int index) const =0 |
Public Member Functions inherited from VoronoiMeshInterface | |
virtual | ~VoronoiMeshInterface () |
virtual VoronoiMeshSnapshot * | voronoiMesh () const =0 |
A VoronoiMeshMedium instance represents a transfer medium with a spatial density distribution described by a list of sites generating a Voronoi tesselation of a cubodail domain. The data is usually extracted from a cosmological simulation snapshot, and it must be provided in a column text file formatted as described below.
Refer to the description of the TextInFile class for information on overall formatting and on how to include header lines specifying the units for each column in the input file. In case the input file has no unit specifications, the default units mentioned below are used instead. The number of columns expected in the input file depends on the options configured by the user for this VoronoiMeshMedium instance:
\[ x\,(\mathrm{pc}) \quad y\,(\mathrm{pc}) \quad z\,(\mathrm{pc}) \quad \{\, \rho\,(\text{M}_\odot\,\text{pc}^{-3}) \;\;|\;\; M\,(\text{M}_\odot) \;\;|\;\; n\,(\text{cm}^{-3}) \;\;|\;\; N\,(1) \,\} \quad [Z\,(1)] \quad [T\,(\mathrm{K})] \quad [ v_x\,(\mathrm{km/s}) \quad v_y\,(\mathrm{km/s}) \quad v_z\,(\mathrm{km/s}) ] \quad [ B_x\,(\mu\mathrm{G}) \quad B_y\,(\mu\mathrm{G}) \quad B_z\,(\mu\mathrm{G}) ] \quad [ \dots\text{mix family params}\dots ] \]
The first three columns are the \(x\), \(y\) and \(z\) coordinates of the Voronoi site (i.e. the location defining a particular Voronoi cell).
Depending on the value of the massType option, the fourth column lists the average mass density \(\rho\), the integrated mass \(M\), the average number density \(n\), or the integrated number density \(N\) for the cell corresponding to the site. This quantity is multiplied by the value of the massFraction option.
If the importMetallicity option is enabled, the next column specifies a "metallicity" fraction, which is multiplied with the mass/density column to obtain the actual mass/density of the cell corresponding to the site. If the importTemperature option is enabled, the next column specifies a temperature. If this temperature is higher than the value of the maxTemperature option, the mass and density for the site are set to zero, regardless of the mass or density specified in the fourth column. If the importTemperature option is disabled, or the maximum temperature value is set to zero, such a cutoff is not applied.
If both the importMetallicity and importTemperature options are enabled, this leads to the following expression for the density of an imported site (or a simular formula for the other mass quantity types):
\[ \rho_\mathrm{imported} = \begin{cases} f_\mathrm{mass}\,Z\,\rho & \mathrm{if}\; T<T_\mathrm{max} \;\mathrm{or}\; T_\mathrm{max}=0 \\ 0 & \mathrm{otherwise} \end{cases} \]
If the importVelocity option is enabled, the subsequent three columns specify the \(v_x\), \(v_y\), \(v_z\) velocity components of the site (considered as the bulk velocity for the mass represented by the site).
If the importMagneticField option is enabled, the subsequent three columns specify the \(B_x\), \(B_y\), \(B_z\) magnetic field vector components for the cell.
Finally, if the importVariableMixParams option is enabled, the remaining columns specify the parameters used by the configured material mix family to select a particular material mix for the cell.
Avoiding construction of the Voronoi tessellation
The algorithm used by the VoronoiMeshSnapshot class for constructing Voronoi tessellations sometimes fails (for example, when generating sites are too close to each other). In those cases, it can be desirable to forego the construction of the Voronoi tessellation and instead use a nearest neighbor search for sampling the density distribution. This is possible as long as the full tessellation is not needed for other purposes, such as to perform radiative transfer or to generate random positions drawn from the density distribution. An important use case is when the medium density distribution defined on the Voronoi grid is resampled to an octree grid to perform radiative transfer. However, the octree subdivision algorithm requires the total mass of the medium in addition to the density samples. Without the full Voronoi tessellation, it is impossible to calculate the cell volume that would allow conversion between cell density and mass.
To enable this use case, the massType option can be set to include both mass density and volume-integrated mass (or both number density and volume-integrated number) in the imported data file. Thus, if the massType option is set to one of these choices, the import file must include two columns (mass density \(\rho\) plus integrated mass \(M\), or number density \(n\) plus integrated number density \(N\) ). Furthermore, if the simulation configuration allows it (i.e. the full Voronoi tessellation is not needed for other purposes), the VoronoiMeshSnapshot class will use the information in these two columns to calculate the cell volumes and the total medium mass, and it will forego construction of the Voronoi tessellation.
When an item of this type is used, the names provided by the conditional value expression "VoronoiMeshInterface" are inserted into the name sets used for evaluating Boolean expressions.
|
inlineprotected |
Default constructor for concrete Item subclass VoronoiMeshMedium : "a transfer medium imported from data represented on a Voronoi mesh" .
|
overrideprotectedvirtual |
This function constructs a new VoronoiMeshSnapshot object, calls its open() function, passes it the domain extent configured by the user, configures it to import a mass or a density column, and finally returns a pointer to the object. Ownership of the Snapshot object is transferred to the caller.
Implements ImportedMedium.
|
overrideprotectedvirtual |
This function implements the VoronoiMeshInterface interface. It returns a pointer to the Voronoi mesh snapshot maintained by this geometry.
Implements VoronoiMeshInterface.