API
Spacetime
Geometric functions
Allocating methods
Skylight.metric
— Methodmetric(position::AbstractVector, spacetime::AbstractSpacetime)
Evaluate the spacetime metric at the given position and return the result.
Skylight.metric_inverse
— Methodmetric_inverse(position::AbstractVector, spacetime::AbstractSpacetime)
Evaluate the inverse of the metric at the given position and return the result.
Skylight.volume_element
— Methodvolume_element(position::AbstractVector, spacetime::AbstractSpacetime)
Compute $\sqrt{-\text{det}(g)}$ at the given position
Skylight.christoffel
— Methodchristoffel(position::AbstractVector, spacetime::AbstractSpacetime)
Evaluate the Christoffel symbols of the second kind at the given position and return the result as a 4x4x4
array Γ
, where Γ[α,μ,ν]
corresponds to
$\Gamma^\alpha_{\mu \nu} = \frac{1}{2} g^{\alpha \rho}(\partial_\mu g_{\rho \nu} + \partial_\nu g_{\rho \mu} - \partial_\rho g_{\mu \nu}).$
Non-allocating methods
For computing these quantities within tight loops, we suggest to use the following non-allocating methods that write the output on preallocated arrays, and use caches to store intermediate results.
Skylight.metric!
— Methodmetric!(g::AbstractMatrix, position::AbstractVector, spacetime::AbstractSpacetime, cache::Union{Nothing, AbstractSpacetimeCache})
Evaluate the spacetime metric at the given position and store the result in g
using cache
for temporary storage.
The cache should be preallocated as cache = allocate_cache(spacetime)
.
See also allocate_cache
.
Skylight.metric_inverse!
— Methodmetric_inverse!(ginv::AbstractMatrix, position::AbstractVector, spacetime::AbstractSpacetime, g::AbstractMatrix, cache::Union{Nothing, AbstractSpacetimeCache})
Evaluate the inverse of the metric at the given position and store the result in the given array, using g
and cache
for temporary storage, which must be preallocated as g = zeros(4,4)
and cache = allocate_cache(spacetime)
.
See also allocate_cache
.
Skylight.volume_element
— Methodvolume_element(position::AbstractVector, spacetime::AbstractSpacetime, g::AbstractMatrix, cache::Union{Nothing, AbstractSpacetimeCache})
Compute $\sqrt{-\text{det}(g)}$ at the given position, using g
and cache
for temporary storage, which must be preallocated as g = zeros(4,4)
and cache = allocate_cache(spacetime)
.
See also allocate_cache
.
Skylight.christoffel!
— Methodchristoffel!(Γ::AbstractArray, position::AbstractVector, spacetime::AbstractSpacetime, cache::Union{Nothing,AbstractChristoffelCache})
Evaluate the Christoffel symbols of the second kind at the given position and store the result in Γ
, where Γ[α,μ,ν]
corresponds to
$\Gamma^\alpha_{\mu \nu} = \frac{1}{2} g^{\alpha \rho}(\partial_\mu g_{\rho \nu} + \partial_\nu g_{\rho \mu} - \partial_\rho g_{\mu \nu}).$
The cache must be preallocated as cache = allocate_christoffel_cache(spacetime)
.
See also allocate_christoffel_cache
.
Other functions
Skylight.coordinates_topology
— Methodcoordinates_topology(spacetime::AbstractSpacetime)
Return the topology of the coordinates of the given spacetime.
Skylight.radius
— Methodradius(position, spacetime)
Radius of the given position in the given spacetime.
Skylight.event_horizon_radius
— Methodevent_horizon_radius(spacetime)
Radius of the event horizon of the given spacetime. Defined only for black hole spacetimes.
Skylight.isco_radius
— Methodisco_radius(spacetime, rotation_sense::AbstractRotationSense)
Radius of the innermost stable circular orbit in the given spacetime and rotation sense (either Prograde() or Retrograde()).
Skylight.mbco_radius
— Methodmbco_radius(spacetime, rotation_sense::AbstractRotationSense)
Radius of the marginally bound circular orbit in the given spacetime and rotation sense (either Prograde() or Retrograde()).
Skylight.circular_geodesic_angular_speed
— Methodcircular_geodesic_angular_speed(position, spacetime, rotation_sense::AbstractRotationSense)
Angular speed of a circular geodesic at the given position
in
spacetime`for a particle rotating in the given
rotation_sense`.
Cache allocation
Skylight.allocate_cache
— Methodallocate_cache(spacetime::AbstractSpacetime)
Allocate a cache object for the given spacetime. The cache object is used to store temporary data in spacetime-related calculations.
See also metric!
.
Skylight.allocate_christoffel_cache
— Methodallocate_christoffel_cache(spacetime::AbstractSpacetime)
Allocate a cache object for Christoffel symbols calculations.
See also christoffel!
.
Radiative model
Skylight.rest_frame_four_velocity!
— Methodrest_frame_four_velocity!(vector::AbstractVector, position::AbstractVector, metric::AbstractMatrix, spacetime::AbstractSpacetime, model::AbstractRadiativeModel, coords_top::AbstractCoordinatesTopology, spacetime_cache::AbstractSpacetimeCache, model_cache::AbstractModelCache)
Rest frame four velocity of the model at given `position`. This is the frame where the model radiative functions are defined.
Arguments
vector
: Output vector.position
: Position where the four-velocity is evaluated.metric
: Metric tensor atposition
.spacetime
: Spacetime.model
: Radiative model.coords_top
: Coordinates topology.spacetime_cache
: Spacetime cache.model_cache
: Model cache.
See also
Skylight.rest_frame_bolometric_intensity
— Methodrest_frame_bolometric_intensity(position::AbstractVector, momentum::AbstractVector, rest_frame_four_velocity::AbstractVector, metric::AbstractMatrix, spacetime::AbstractSpacetime, model::AbstractRadiativeModel, coords_top::AbstractCoordinatesTopology, cache::AbstractModelCache)
Bolometric intensity of the model at given `position`.
Arguments
position
: Position where the intensity is evaluated.momentum
: Momentum of the emission (frequency and direction).rest_frame_four_velocity
: Rest frame four velocity of the model atposition
. Must but be normalized.metric
: Metric tensor atposition
.spacetime
: Spacetime.model
: Radiative model.coords_top
: Coordinates topology.cache
: Model cache.
See also
Skylight.rest_frame_specific_intensity
— Methodrest_frame_specific_intensity(position::AbstractVector, momentum::AbstractVector, energy::Real, rest_frame_four_velocity::AbstractVector, metric::AbstractMatrix, spacetime::AbstractSpacetime, model::AbstractRadiativeModel, coords_top::AbstractCoordinatesTopology, cache::AbstractModelCache)
Specific intensity of the model at given `position`.
Arguments
position
: Position where the intensity is evaluated.momentum
: Momentum of the emission (frequency and direction).energy
: Energy of the emission. This should be assumed to be in CGS units.rest_frame_four_velocity
: Rest frame four velocity of the model atposition
. Must but be normalized.metric
: Metric tensor atposition
.spacetime
: Spacetime.model
: Radiative model.coords_top
: Coordinates topology.cache
: Model cache.
See also
Skylight.is_final_position_at_source
— Methodis_final_position_at_source(position::AbstractVector, spacetime::AbstractSpacetime, model::AbstractRadiativeModel)
Check if the final position of the photon is at the source of the model. This function is used in the observer-to-emitter method
in vacuum to discard rays that do not intersect the source.
Arguments
position
: Final position of the geodesic.spacetime
: Spacetime.model
: Radiative model.
Skylight.lorentz_factors
— Methodlorentz_factors(positions, spacetime::AbstractSpacetime, model::AbstractRadiativeModel)
Lorentz factors of the rest frame four velocities of `model` at given list of positions. Positions should be an iterable
object with the positions as elements.
# Returns
An array with the Lorentz factors of the rest frame four velocities of the model at the given positions.
# Example
```
positions = [[0.0, 5.0, 0.0, 0.0], [1.0, 0.0, 5.0, 0.0]]
spacetime = SchwarzschildSpacetimeSphericalCoordinates(M=1.0)
model = DummyModel()
γ = lorentz_factors(positions, spacetime, model)
```
Skylight.allocate_cache
— Methodallocate_cache(model::AbstractRadiativeModel)
Allocate a cache object for the given model. The cache object is used to store temporary data in radiative-model-related calculations.
Surface emission models
Skylight.surface_differential!
— Methodsurface_differential!(differential::AbstractVector, position::AbstractVector, model::AbstractSurfaceEmissionModel, coords_top::AbstractCoordinatesTopology)
Differential of the function defining the emitting surface in the model. For example, for an emitting sphere in Cartesian coordinates, the output would be `[0,2x,2y,2z]`.
The normalization of the differential is not important, as it is only used to calculate the surface (unit) normal in terms of the metric.
Arguments
differential
: Output vector.position
: Position where the differential is evaluated.model
: Radiative model.coords_top
: Coordinates topology.
Thermal emission models
Skylight.temperature
— Methodtemperature(position::AbstractVector, spacetime::AbstractSpacetime, model::AbstractRadiativeModel)
Temperature of the model at given `position`.
Line emission models
Skylight.line_emission_profile
— Methodline_emission_profile(position::AbstractVector, momentum::AbstractVector, rest_frame_four_velocity::AbstractVector, metric::AbstractMatrix, spacetime::AbstractSpacetime, model::AbstractRadiativeModel, coords_top::AbstractCoordinatesTopology, cache::AbstractModelCache)
Emissivity profile for line emission radiative models.
Arguments
position
: Position of the emission.momentum
: Momentum of the emission (frequency and direction). Must be null.rest_frame_four_velocity
: Rest frame four velocity of the model atposition
. Must but be normalized.metric
: Metric tensor atposition
.spacetime
: Spacetime.model
: Radiative model.coords_top
: Coordinates topology.cache
: Model cache.
See also