Computation of derived quantities
These functions are used internally and none are exported.
These functions depend on the particulars of the simulation code (e.g. units).
GalaxyInspector.computeClumpingFactor
— MethodcomputeClumpingFactor(density::Vector{<:Number})::Float64
Compute the clumping factor,
\[C_\rho = \frac{\langle \rho^2 \rangle}{\langle \rho \rangle^2} \, .\]
Arguments
density::Vector{<:Number}
: The density of the cells/particles.
Returns
- The clumping factor.
GalaxyInspector.computeDepletionTime
— MethodcomputeDepletionTime(
mass::Vector{<:Unitful.Mass},
sfr::Vector{<:Unitful.MassFlow},
)::Vector{<:Unitful.Time}
Compute the depletion time,
\[t_\mathrm{ff} = \frac{M_\mathrm{gas}}{\dot{M}_\star} \, .\]
Arguments
mass::Vector{<:Unitful.Mass}
: The gas mass of the cells/particles.sfr::Vector{<:Unitful.MassFlow}
: The SFR associated to each cell/particle.
Returns
- The depletion time.
GalaxyInspector.computeEfficiencyFF
— MethodcomputeEfficiencyFF(
density::Vector{<:Unitful.Density},
mass::Vector{<:Unitful.Mass},
sfr::Vector{<:Unitful.MassFlow},
)::Vector{Float64}
Compute the star formation efficiency per free-fall time, according to the definition in equation 1 of Krumholz (2012),
\[\epsilon_\mathrm{ff} = \frac{t_\mathrm{ff}}{t_\mathrm{dep}} \, .\]
where
\[t_\mathrm{ff} = \sqrt{\frac{3 \, \pi}{32 \, G \, \rho}} \, ,\]
is the free-fall time, and
\[t_\mathrm{dep} = \frac{M_\mathrm{H_2}}{\dot{M}_\star} \, ,\]
is the depletion time.
Arguments
density::Vector{<:Unitful.Density}
: The molecular hydrogen ($\\mathrm{H_2}$) density of the cells/particles.mass::Vector{<:Unitful.Mass}
: The gas mass of the cells/particles.sfr::Vector{<:Unitful.MassFlow}
: The SFR associated to each cell/particle.
Returns
- The star formation efficiency per free-fall time.
References
M. R. Krumholz et al. (2012). A UNIVERSAL, LOCAL STAR FORMATION LAW IN GALACTIC CLOUDS, NEARBY GALAXIES, HIGH-REDSHIFT DISKS, AND STARBURSTS. The Astrophysical Journal, 745(1), 69. doi:10.1088/0004-637X/745/1/69
GalaxyInspector.computeSFR
— MethodcomputeSFR(
data_dict::Dict;
<keyword arguments>
)::Vector{<:Unitful.MassFlow}
Compute the star formation rate of each stellar particle.
For stellar particles younger than age_resol
, the SFR is its mass divided by age_resol
. It is defined as 0 for older particles.
Arguments
data_dict::Dict
: A dictionary with the following shape::sim_data
-> ::Simulation (seeSimulation
).:snap_data
-> ::Snapshot (seeSnapshot
).:gc_data
-> ::GroupCatalog (seeGroupCatalog
).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
age_resol::Unitful.Time=AGE_RESOLUTION
: Age resolution for the SFR.
Returns
- The star formation rate of each stellar particle.
GalaxyInspector.computeStellarAge
— MethodcomputeStellarAge(data_dict::Dict)::Vector{<:Unitful.Time}
Compute the age of the stars.
Arguments
data_dict::Dict
: A dictionary with the following shape::sim_data
-> ::Simulation (seeSimulation
).:snap_data
-> ::Snapshot (seeSnapshot
).:gc_data
-> ::GroupCatalog (seeGroupCatalog
).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
Returns
- The stellar ages.
GalaxyInspector.computeTemperature
— MethodcomputeTemperature(
internal_energy::Vector{<:SpecificEnergy},
electron_fraction::Vector{Float32},
)::Vector{<:Unitful.Temperature}
Compute the gas temperature.
Arguments
internal_energy::Vector{<:SpecificEnergy}
: Specific internal energy of every gas cell/particle.electron_fraction::Vector{Float32}
: Number fraction of electrons in every gas cell/particle.
Returns
- The temperature of each gas cell/particle.
GalaxyInspector.computeTime
— MethodcomputeTime(a::Real, header::SnapshotHeader; <keyword arguments>)::Unitful.Time
Compute the physical time corresponding to the scale factor a
.
To get the physical time $t$ from the scale factor a
, one does the integral:
\[t = \frac{1}{H_0} \int_0^a \frac{\mathrm{d}a'}{a' \, \sqrt{\mathcal{E}(a')}} \, ,\]
where
\[\mathcal{E}(a) = \Omega_\Lambda + \Omega_m \, a^{-3} + \Omega_r \, a^{-4} + \Omega_K \, a^{-2} \, .\]
Arguments
a::Real
: Scale factor.header::SnapshotHeader
: A header of the simulation, containing the cosmological parameters.a0::Float64=0.0
: Initial scale factor.
Returns
- The physical time.
GalaxyInspector.computeTime
— MethodcomputeTime(
scale_factors::Vector{<:Real},
header::SnapshotHeader;
<keyword arguments>
)::Vector{<:Unitful.Time}
Compute the physical time corresponding to each of the scale_factors
.
To get the physical time $t$ from the scale factor a
, one does the integral:
\[t = \frac{1}{H_0} \int_0^a \frac{\mathrm{d}a'}{a' \, \sqrt{\mathcal{E}(a')}} \, ,\]
where
\[\mathcal{E}(a) = \Omega_\Lambda + \Omega_m \, a^{-3} + \Omega_r \, a^{-4} + \Omega_K \, a^{-2} \, .\]
Arguments
scale_factors::Vector{<:Real}
: Scale factors.header::SnapshotHeader
: A header of the simulation, containing the cosmological parameters.a0::Float64=0.0
: Initial scale factor.
Returns
- A vector with the physical times.
GalaxyInspector.computeTimeTicks
— MethodcomputeTimeTicks(
paths::Vector{<:Union{Missing,String}},
)::Tuple{Vector{Float64},Vector{Float64},Vector{<:Unitful.Time},Vector{<:Unitful.Time}}
Compute the different times stamps associated with each snapshot in paths
.
Arguments
paths::Vector{<:Union{Missing,String}}
: Paths to the snapshots.
Returns
A tuple with four elements:
- A vector with the scale factors.
- A vector with the redshifts.
- A vector with the physical times (physical time since the Big Bang).
- A vector with the lookback times (physical time left to reach the last snapshot).
GalaxyInspector.integrateQty
— MethodintegrateQty(data_dict::Dict, quantity::Symbol)::Number
Compute an integrated quantity for the whole system in data_dict
.
Arguments
data_dict::Dict
: A dictionary with the following shape::sim_data
-> ::Simulation (seeSimulation
).:snap_data
-> ::Snapshot (seeSnapshot
).:gc_data
-> ::GroupCatalog (seeGroupCatalog
).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
quantity::Symbol
: The possibilities are::stellar_mass
-> Stellar mass.:gas_mass
-> Gas mass.:hydrogen_mass
-> Hydrogen mass.:dm_mass
-> Dark matter mass.:bh_mass
-> Black hole mass.:molecular_mass
-> Molecular hydrogen ($\mathrm{H_2}$) mass.:br_molecular_mass
-> Molecular hydrogen ($\mathrm{H_2}$) mass, computed using the pressure relation in Blitz et al. (2006).:atomic_mass
-> Atomic hydrogen ($\mathrm{HI}$) mass.:ionized_mass
-> Ionized hydrogen ($\mathrm{HII}$) mass.:neutral_mass
-> Neutral hydrogen ($\mathrm{HI + H_2}$) mass.:stellar_gas_mass
-> Stellar gas mass (according to our SF model).:ode_metal_mass
-> Metal mass (according to our SF model).:ode_metallicity
-> Metallicity (according to our SF model).:dust_mass
-> Dust mass.:stellar_number
-> Number of stellar particles.:gas_number
-> Number of gas cells.:dm_number
-> Number of dark matter particles.:bh_number
-> Number of black hole particles.:molecular_fraction
-> Gas mass fraction of molecular hydrogen.:br_molecular_fraction
-> Gas mass fraction of molecular hydrogen, computed using the pressure relation in Blitz et al. (2006).:atomic_fraction
-> Gas mass fraction of atomic hydrogen.:ionized_fraction
-> Gas mass fraction of ionized hydrogen.:neutral_fraction
-> Gas mass fraction of neutral hydrogen.:molecular_neutral_fraction
-> Fraction of molecular hydrogen in the neutral gas.:ionized_neutral_fraction
-> Fraction of ionized gas to neutral gas.:gas_mass_density
-> Mean gas mass density.:stellar_gas_fraction
-> Stellar gas fraction (according to our SF model).:metal_gas_fraction
-> Metallicity (according to our SF model).:dust_fraction
-> Dust mass fraction.:stellar_area_density
-> Stellar area mass density, for a radius ofDISK_R
.:gas_area_density
-> Gas mass surface density, for a radius ofDISK_R
.:molecular_area_density
-> Molecular mass surface density, for a radius ofDISK_R
.:br_molecular_area_density
-> Molecular mass surface density, for a radius ofDISK_R
, computed using the pressure relation in Blitz et al. (2006).:atomic_area_density
-> Atomic hydrogen area mass density, for a radius ofDISK_R
.:ionized_area_density
-> Ionized hydrogen area mass density, for a radius ofDISK_R
.:neutral_area_density
-> Neutral mass surface density, for a radius ofDISK_R
.:sfr_area_density
-> Star formation rate area density, for the lastAGE_RESOLUTION
and a radius ofDISK_R
.:gas_td
-> Gas depletion time.:molecular_td
-> The molecular hydrogen ($\mathrm{H_2}$) depletion time.:br_molecular_td
-> The Molecular hydrogen ($\mathrm{H_2}$) depletion time, computed using the pressure relation in Blitz et al. (2006).:atomic_td
-> The atomic hydrogen ($\mathrm{HI}$) depletion time.:ionized_td
-> The ionized hydrogen ($\mathrm{HII}$) depletion time.:neutral_td
-> The neutral hydrogen ($\mathrm{HI + H_2}$) depletion time.:gas_metallicity
-> Mass fraction of all elements above He in the gas (solar units).:stellar_metallicity
-> Mass fraction of all elements above He in the stars (solar units).:X_gas_abundance
-> Gas abundance of element $\mathrm{X}$, as $12 + \log_{10}(\mathrm{X \, / \, H})$. The possibilities are the keys ofELEMENT_INDEX
.:X_stellar_abundance
-> Stellar abundance of element $\mathrm{X}$, as $12 + \log_{10}(\mathrm{X \, / \, H})$. The possibilities are the keys ofELEMENT_INDEX
.:stellar_specific_am
-> Norm of the stellar specific angular momentum.:gas_specific_am
-> Norm of the gas specific angular momentum.:dm_specific_am
-> Norm of the dark matter specific angular momentum.:sfr
-> Star formation rate.:ssfr
-> The specific star formation rate.:observational_sfr
-> Star formation rate of the lastAGE_RESOLUTION
.:observational_ssfr
-> The specific star formation rate of the lastAGE_RESOLUTION
.:stellar_eff
-> Star formation efficiency per free-fall time for the gas that has turn into stars.:gas_eff
-> Star formation efficiency per free-fall time for the gas.:molecular_eff
-> Star formation efficiency per free-fall time for the molecular hydrogen ($\mathrm{H_2}$) gas.:br_molecular_eff
-> Star formation efficiency per free-fall time for the molecular hydrogen ($\mathrm{H_2}$) gas, computed using the pressure relation in Blitz et al. (2006).:atomic_eff
-> Star formation efficiency per free-fall time for the atomic hydrogen ($\mathrm{HI}$) gas.:ionized_eff
-> Star formation efficiency per free-fall time for the ionized hydrogen ($\mathrm{HII}$) gas.:neutral_eff
-> Star formation efficiency per free-fall time for the neutral hydrogen ($\mathrm{HI + H_2}$) gas.:scale_factor
-> Scale factor.:redshift
-> Redshift.:physical_time
-> Physical time since the Big Bang.:lookback_time
-> Physical time left to reach the last snapshot.:ode_gas_it
-> Integration time.:ode_gas_tau_s
-> Star formation time scale, $\tau_\mathrm{S}$.:ode_gas_eta_d
-> Photodissociation efficiency, $\eta_\mathrm{diss}$.:ode_gas_eta_i
-> Photoionization efficiency, $\eta_\mathrm{ion}$.:ode_gas_r
-> Mass recycling parameter, $R$.:ode_gas_cold_mf
-> Cold gas mass fraction.:ode_stellar_it
-> Integration time, for the gas that form the stars.:ode_stellar_tau_s
-> Star formation time scale, $\tau_\mathrm{S}$, for the gas that form the stars.:ode_stellar_eta_d
-> Photodissociation efficiency, $\eta_\mathrm{diss}$, for the gas that form the stars.:ode_stellar_eta_i
-> Photoionization efficiency, $\eta_\mathrm{ion}$, for the gas that form the stars.:ode_stellar_r
-> Mass recycling parameter, $R$, for the gas that form the stars.:ode_stellar_cold_mf
-> Cold gas mass fraction, for the gas that form the stars.:ode_stellar_gas_rho
-> Gas mass density, for the gas that form the stars.:ode_stellar_gas_Z
-> Gas metallicity, for the gas that form the stars (solar units).:ode_stellar_gas_mass
-> Cell mass, for the gas that form the stars.:ode_stellar_gas_sfr
-> SFR associated to the gas particles/cells within the code, for the gas that form the stars.:ode_stellar_gas_P
-> Gas pressure, for the gas that form the stars.
Returns
- The value of
quantity
for the whole system indata_dict
.
References
L. Blitz et al. (2006). The Role of Pressure in GMC Formation II: The H2-Pressure Relation. The Astrophysical Journal, 650(2), 933. doi:10.1086/505417
GalaxyInspector.scatterQty
— MethodscatterQty(data_dict::Dict, quantity::Symbol)::Vector{<:Number}
Compute a quantity for each cell/particle in data_dict
.
Arguments
data_dict::Dict
: A dictionary with the following shape::sim_data
-> ::Simulation (seeSimulation
).:snap_data
-> ::Snapshot (seeSnapshot
).:gc_data
-> ::GroupCatalog (seeGroupCatalog
).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).cell/particle type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).groupcat type
-> (block
-> data ofblock
,block
-> data ofblock
, ...).- ...
quantity::Symbol
: The possibilities are::stellar_mass
-> Stellar mass.:gas_mass
-> Gas mass.:hydrogen_mass
-> Hydrogen mass.:dm_mass
-> Dark matter mass.:bh_mass
-> Black hole mass.:molecular_mass
-> Molecular hydrogen ($\mathrm{H_2}$) mass.:br_molecular_mass
-> Molecular hydrogen ($\mathrm{H_2}$) mass, computed using the pressure relation in Blitz et al. (2006).:atomic_mass
-> Atomic hydrogen ($\mathrm{HI}$) mass.:ionized_mass
-> Ionized hydrogen ($\mathrm{HII}$) mass.:neutral_mass
-> Neutral hydrogen ($\mathrm{HI + H_2}$) mass.:stellar_gas_mass
-> Stellar gas mass (according to our SF model).:ode_metal_mass
-> Metal mass (according to our SF model).:ode_metallicity
-> Metallicity (according to our SF model).:dust_mass
-> Dust mass.:molecular_fraction
-> Gas mass fraction of molecular hydrogen.:br_molecular_fraction
-> Gas mass fraction of molecular hydrogen, computed using the pressure relation in Blitz et al. (2006).:atomic_fraction
-> Gas mass fraction of atomic hydrogen.:ionized_fraction
-> Gas mass fraction of ionized hydrogen.:neutral_fraction
-> Gas mass fraction of neutral hydrogen.:molecular_neutral_fraction
-> Fraction of molecular hydrogen in the neutral gas.:ionized_neutral_fraction
-> Fraction of ionized gas to neutral gas.:stellar_gas_fraction
-> Stellar gas fraction (according to our SF model).:metal_gas_fraction
-> Metallicity (according to our SF model).:dust_fraction
-> Dust mass fraction.:gas_mass_density
-> Gas mass density.:hydrogen_mass_density
-> Hydrogen mass density.:gas_number_density
-> Gas number density.:molecular_number_density
-> Molecular hydrogen number density.:br_molecular_number_density
-> Molecular hydrogen number density, computed using the pressure relation in Blitz et al. (2006).:atomic_number_density
-> Atomic hydrogen number density.:ionized_number_density
-> Ionized hydrogen number density.:neutral_number_density
-> Neutral hydrogen number density.:gas_td
-> Total gas depletion time.:molecular_td
-> Molecular hydrogen ($\mathrm{H_2}$) depletion time.:br_molecular_td
-> Molecular hydrogen ($\mathrm{H_2}$) depletion time, computed using the pressure relation in Blitz et al. (2006).:atomic_td
-> Atomic hydrogen ($\mathrm{HI}$) depletion time.:ionized_td
-> Ionized hydrogen ($\mathrm{HII}$) depletion time.:neutral_td
-> Neutral hydrogen ($\mathrm{HI + H_2}$) depletion time.:gas_metallicity
-> Mass fraction of all elements above He in the gas (solar units).:stellar_metallicity
-> Mass fraction of all elements above He in the stars (solar units).:X_gas_abundance
-> Gas abundance of element $\mathrm{X}$, as $12 + \log_{10}(\mathrm{X \, / \, H})$. The possibilities are the keys ofELEMENT_INDEX
.:X_stellar_abundance
-> Stellar abundance of element $\mathrm{X}$, as $12 + \log_{10}(\mathrm{X \, / \, H})$. The possibilities are the keys ofELEMENT_INDEX
.:stellar_radial_distance
-> Distance of every stellar particle to the origin.:gas_radial_distance
-> Distance of every gas cell to the origin.:dm_radial_distance
-> Distance of every dark matter particle to the origin.:stellar_xy_distance
-> Projected distance of every stellar particle to the origin.:gas_xy_distance
-> Projected distance of every gas cell to the origin.:dm_xy_distance
-> Projected distance of every dark matter particle to the origin.:gas_sfr
-> SFR associated to each gas particle/cell within the code.:stellar_circularity
-> Stellar circularity.:stellar_vcirc
-> Stellar circular velocity.:stellar_vradial
-> Stellar radial speed.:stellar_vtangential
-> Stellar tangential speed.:stellar_vzstar
-> Stellar speed in the z direction, computed as $v_z \, \mathrm{sign}(z)$.:stellar_age
-> Stellar age.:sfr
-> Star formation rate.:ssfr
-> The specific star formation rate.:observational_sfr
-> Star formation rate of the lastAGE_RESOLUTION
.:observational_ssfr
-> The specific star formation rate of the lastAGE_RESOLUTION
.:stellar_eff
-> Star formation efficiency per free-fall time for the gas that has turn into stars.:gas_eff
-> Star formation efficiency per free-fall time for the gas.:molecular_eff
-> Star formation efficiency per free-fall time for the molecular hydrogen ($\mathrm{H_2}$) gas.:br_molecular_eff
-> Star formation efficiency per free-fall time for the molecular hydrogen ($\mathrm{H_2}$) gas, computed using the pressure relation in Blitz et al. (2006).:atomic_eff
-> Star formation efficiency per free-fall time for the atomic hydrogen ($\mathrm{HI}$) gas.:ionized_eff
-> Star formation efficiency per free-fall time for the ionized hydrogen ($\mathrm{HII}$) gas.:neutral_eff
-> Star formation efficiency per free-fall time for the neutral hydrogen ($\mathrm{HI + H_2}$) gas.:temperature
-> Gas temperature, as $\log_{10}(T \, / \, \mathrm{K})$.:pressure
-> Gas pressure.:ode_gas_it
-> Integration time.:ode_gas_tau_s
-> Star formation time scale, $\tau_\mathrm{S}$.:ode_gas_eta_d
-> Photodissociation efficiency, $\eta_\mathrm{diss}$.:ode_gas_eta_i
-> Photoionization efficiency, $\eta_\mathrm{ion}$.:ode_gas_r
-> Mass recycling parameter, $R$.:ode_gas_cold_mf
-> Cold gas mass fraction.:ode_stellar_it
-> Integration time, for the gas that form the stars.:ode_stellar_tau_s
-> Star formation time scale, $\tau_\mathrm{S}$, for the gas that form the stars.:ode_stellar_eta_d
-> Photodissociation efficiency, $\eta_\mathrm{diss}$, for the gas that form the stars.:ode_stellar_eta_i
-> Photoionization efficiency, $\eta_\mathrm{ion}$, for the gas that form the stars.:ode_stellar_r
-> Mass recycling parameter, $R$, for the gas that form the stars.:ode_stellar_cold_mf
-> Cold gas mass fraction, for the gas that form the stars.:ode_stellar_gas_rho
-> Gas mass density, for the gas that form the stars.:ode_stellar_gas_Z
-> Gas metallicity, for the gas that form the stars (solar units).:ode_stellar_gas_mass
-> Cell mass, for the gas that form the stars.:ode_stellar_gas_sfr
-> SFR associated to the gas particles/cells within the code, for the gas that form the stars.:ode_stellar_gas_P
-> Gas pressure, for the gas that form the stars.
Returns
- The values of
quantity
for every cell/particle.
References
L. Blitz et al. (2006). The Role of Pressure in GMC Formation II: The H2-Pressure Relation. The Astrophysical Journal, 650(2), 933. doi:10.1086/505417