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, cudaTextureObject_t besselTexObj)

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.

  • besselTexObj – CUDA texture object for accelerated Modified Bessel function \( K_2 \) lookups.

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

__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