track.cu
This section contains model dependent functions defined in the track.cu file related to the iharm model.
Functions
Functions
-
__device__ void track_super_photon(struct of_photonSOA ph, cudaTextureObject_t d_p, const double *d_table_ptr, struct of_photonSOA scat_ofphoton, const unsigned long long starting_scattering_index, const int round_scat, const unsigned long long photon_index, curandState *localState)
Main function responsible for tracking a superphoton through the spacetime while accounting for absorption and scattering.
Contains the loop that iteratively updates the photon’s position and momentum, checks for interactions, and modifies the photon’s properties accordingly.
- Parameters:
ph – The superphoton structure containing its properties.
d_p – Device pointer or texture object for plasma data, depending on compilation settings.
d_table_ptr – Pointer to the scattering probability and cross-section lookup tables.
scat_ofphoton – A secondary SoA used to store the relevant local and instantaneous information of the scattered photon to be processed later.
starting_scattering_index – The starting global photon index for the current scattering batch.
round_scat – The current scattering layer index.
photon_index – The global index of the photon being tracked.
localState – Pointer to the curand state for random number generation.
- Returns:
void
-
__device__ void init_dKdlam(double X[], double Kcon[], double dK[])
Initializes the change in superphoton momentum per unit affine parameter \( \frac{dK^{\mu}}{d\lambda} \).
This function computes the initial values of \( \frac{dK^{\mu}}{d\lambda} \) based on the superphoton’s position and momentum four-vectors.
- Parameters:
X – The superphoton’s position four-vector.
Kcon – The superphoton’s contravariant momentum four-vector.
dK – The output array to store the initialized \( \frac{dK^{\mu}}{d\lambda} \) values.
- Returns:
void
-
__noinline__ __device__ void push_photon(double X[NDIM], double Kcon[NDIM], double dKcon[NDIM], const double dl, double *E0)
Pushes the superphoton’s position and momentum forward by a small affine parameter step.
This function updates the superphoton’s position and momentum four-vectors based on the computed changes per unit affine parameter and the specified step size.
- Parameters:
X – The superphoton’s position four-vector.
Kcon – The superphoton’s contravariant momentum four-vector.
dKcon – The change in superphoton’s contravariant momentum per unit affine parameter.
dl – The step size in affine parameter.
E0 – Pointer to the superphoton’s energy.
- Returns:
void
-
__device__ void record_super_photon(struct of_photonSOA ph, struct of_spectrum *d_spect, unsigned long long photon_index)
Records a photon’s final properties into the global spectrum array. This function maps a photon’s energy and polar exit angle to a specific energy and angular bin in the spectrum. Because many threads may try to update the same bin simultaneously, it uses CUDA atomic operations to ensure thread safety.
Note
Energy is binned logarithmically: \( i_E \approx \frac{\ln(E) - \ln(E_0)}{\Delta \ln E} \).
Note
Polar angle \( \theta \) is binned into angular zones, mirrored across the equator.
- Parameters:
ph – The Structure of Arrays (SOA) containing all photon data.
d_spect – Pointer to the global spectrum structure array.
photon_index – The specific index of the photon being recorded.
- Returns:
void