Computational Domains

Class providing computational domains for Monte Carlo radiative transfer calculations— discretized spatial grids that partition the simulation volume into cells, each carrying absorption and emission properties. A computational domain supports iterating over cells, locating a position within its cell structure, computing ray path lengths to cell boundaries, accumulating photon packet absorptions, and solving for the local ionization and temperature state. Implementations include Cartesian and spherical grids.

Default implementation: computationalDomainCartesian3D

Methods

iteratorvoid

Return an iterator which can be used to iterate over the domain.

  • class(domainIterator), intent(inout), allocatable :: iterator

initializevoid

Initialize the computational domain, setting up internal data structures and allocating resources required before radiative transfer iterations begin.

resetvoid

Reset the computational domain state prior to beginning a new radiative transfer iteration, clearing accumulated photon packet statistics while preserving the domain geometry and cell structure.

indicesFromPositionvoid

Return a set of indices identifying the domain cell containing a position. For points outside the domain values of -huge(0) will be returned.

  • double precision , dimension(3), intent(in ) :: position

  • integer (c_size_t), allocatable, dimension(:), intent(inout) :: indices

absorptionCoefficientdouble precision

Return the absorption coefficient (in units of inverse length) in the domain cell identified by the given indices for a photon packet at its current wavelength, used to compute photon packet attenuation as it traverses the cell.

  • class (radiativeTransferPhotonPacketClass) , intent(inout) :: photonPacket

  • integer(c_size_t ), dimension(:), intent(in ) :: indices

lengthToCellBoundarydouble precision

Return the length until a photon packet hits a cell boundary. Also return the indices of that neighboring cell.

  • class (radiativeTransferPhotonPacketClass) , intent(inout) :: photonPacket

  • integer (c_size_t ) , dimension(:), intent(in ) :: indices

  • integer (c_size_t ), allocatable, dimension(:), intent(inout) :: indicesNeighbor

  • double precision , dimension(3), intent( out) :: positionBoundary

accumulatePhotonPacketvoid

Accumulate “absorptions” from the photon packet as it traverses a cell of the computational domain.

  • class (radiativeTransferPhotonPacketClass) , intent(inout) :: photonPacket

  • integer (c_size_t ), dimension(:), intent(in ) :: indices

  • double precision , intent(in ) :: absorptionCoefficient, lengthTraversed

interactWithPhotonPacketlogical

Interact the photon packet with matter in the computational domain, possibly modifying its properties. Return true if the photon packet is still alive, false if it is absorbed.

  • class (radiativeTransferPhotonPacketClass) , intent(inout) :: photonPacket

  • integer (c_size_t ), dimension(:), intent(inout) :: indices

stateSolvevoid

Solve for the equilibrium state of matter throughout the computational domain given the accumulated radiation field, updating physical quantities such as temperature, ionization state, or chemical abundances in each cell.

convergedlogical

Return true if the computational domain has reached a converged solution, meaning that the matter state (e.g. ionization, temperature) is no longer changing significantly between successive radiative transfer iterations.

outputvoid

Output the current state of the computational domain (cell properties, radiation field, matter state) to the specified HDF5 group for post-processing analysis or diagnostic purposes.

  • type(hdf5Object), intent(inout) :: outputGroup

computationalDomainCartesian3D

Defines a computational domain on a three-dimensional Cartesian grid, with cell boundaries along each axis specified by [xBoundaries], [yBoundaries], and [zBoundaries], and the number of cells per dimension by [countCells]. Convergence of cell quantities is assessed using a percentile criterion controlled by [convergencePercentile] and [convergenceThreshold].

(Default implementation)

Methods

  • next — Move to the next cell in the domain.

Parameters

  • [xBoundaries] (default [-1.0d0,+1.0d0]) — A two-element array \([x_\mathrm{min}, x_\mathrm{max}]\) specifying the physical extent of the 3D Cartesian computational domain along the \(x\)-axis.

  • [yBoundaries] (default [-1.0d0,+1.0d0]) — A two-element array \([y_\mathrm{min}, y_\mathrm{max}]\) specifying the physical extent of the 3D Cartesian computational domain along the \(y\)-axis.

  • [zBoundaries] (default [-1.0d0,+1.0d0]) — A two-element array \([z_\mathrm{min}, z_\mathrm{max}]\) specifying the physical extent of the 3D Cartesian computational domain along the \(z\)-axis.

  • [countCells] (default [3_c_size_t,3_c_size_t,3_c_size_t]) — A three-element integer array specifying the number of grid cells along the \(x\), \(y\), and \(z\) dimensions of the 3D Cartesian computational domain, controlling the spatial resolution of the radiative transfer calculation.

  • [convergencePercentile] (default 0.99d0) — The percentile of cells (between 0 and 1) used in assessing convergence; only this fraction of cells (those with the smallest deviations) must satisfy the convergence threshold, allowing cells with rare high-flux events to be excluded.

  • [convergenceThreshold] (default 2.0d0) — The threshold value for the convergence measure; the domain is considered converged when the specified percentile of cells has a convergence metric below this value, indicating that the radiative transfer solution has stabilized.

  • [convergenceRatioThreshold] (default 1.1d0) — The threshold for the ratio of the convergence criterion between successive iterations; convergence is accepted when this ratio falls below the threshold, indicating that the solution is no longer changing significantly between iterations.

computationalDomainCylindrical

Defines a computational domain on a cylindrical grid, with radial and vertical boundaries specified by [rBoundaries] and [zBoundaries], and the number of cells in each dimension by [countCells]. Convergence of integrated cell quantities is monitored using percentile and threshold criteria set by [convergencePercentile] and [convergenceThreshold].

Methods

  • sampleNode

Parameters

  • [rBoundaries] (default [+0.0d0,+1.0d0]) — A two-element array \([r_\mathrm{min}, r_\mathrm{max}]\) specifying the radial extent of the cylindrical computational domain, where \(r=0\) is the cylinder axis.

  • [zBoundaries] (default [-1.0d0,+1.0d0]) — A two-element array \([z_\mathrm{min}, z_\mathrm{max}]\) specifying the vertical extent of the cylindrical computational domain along the symmetry axis.

  • [countCells] (default [3_c_size_t,3_c_size_t]) — A two-element integer array specifying the number of grid cells along the \(r\) and \(z\) dimensions of the cylindrical computational domain, controlling the spatial resolution of the radiative transfer calculation.

  • [convergencePercentile] (default 0.99d0) — The percentile of cells (between 0 and 1) used in assessing convergence; only this fraction of cells must satisfy the convergence threshold, allowing outlier cells to be excluded.

  • [convergenceThreshold] (default 2.0d0) — The threshold value for the convergence measure; the domain is considered converged when the specified percentile of cells has a convergence metric below this value.

  • [convergenceRatioThreshold] (default 1.1d0) — The threshold for the ratio of the convergence criterion between successive iterations; convergence is accepted when this ratio falls below the threshold, indicating the solution is no longer changing significantly.

  • [rBoundaries] (default [0.0d0,1.0d0]) — A two-element array \([r_\mathrm{min}, r_\mathrm{max}]\) specifying the radial extent of the cylindrical integration domain.

  • [zBoundaries] (default [-1.0d0,+1.0d0]) — A two-element array \([z_\mathrm{min}, z_\mathrm{max}]\) specifying the vertical extent of the cylindrical integration domain along the symmetry axis.

  • [radiusCylinderComoving] — The comoving radius of the cylinder to populate.

  • [radiusBufferComoving] (default 1.0d0) — The comoving buffer radius to add around the cylinder. This is used to ensure that the sample within the cylinder is complete.

  • [massHaloLens] (default -1.0d0) — The mass of the primary lens halo (or a negative value for no lens).

  • [redshiftLens] (default -1.0d0) — The redshift of the primary lens halo (or a negative value for no lens).

computationalDomainSpherical

Defines a computational domain on a one-dimensional spherical grid, with radial boundaries set by [boundaries] and the number of radial cells by [countCells]. Convergence of quantities within each shell is assessed using percentile and threshold criteria specified by [convergencePercentile] and [convergenceThreshold].

Methods

  • next — Move to the next cell in the domain.

Parameters

  • [boundaries] (default [+0.0d0,+1.0d0]) — A two-element array \([r_\mathrm{min}, r_\mathrm{max}]\) specifying the radial extent of the spherically symmetric computational domain.

  • [countCells] (default 3_c_size_t) — The number of radial grid cells in the spherically symmetric computational domain, controlling the radial resolution of the radiative transfer calculation.

  • [convergencePercentile] (default 0.99d0) — The percentile of cells (between 0 and 1) used in assessing convergence; only this fraction of cells must satisfy the convergence threshold, allowing outlier cells to be excluded.

  • [convergenceThreshold] (default 2.0d0) — The threshold value for the convergence measure; the spherical domain is considered converged when the specified percentile of cells has a convergence metric below this value.

  • [convergenceRatioThreshold] (default 1.1d0) — The threshold for the ratio of the convergence criterion between successive iterations; convergence is accepted when this ratio falls below the threshold, indicating the solution is no longer changing significantly.

  • [boundaries] (default [0.0d0,1.0d0]) — A two-element array \([r_\mathrm{min}, r_\mathrm{max}]\) specifying the radial extent of the spherically symmetric integration domain.

  • [variogramFitOption] (default var_str('median')) — Option controlling how the binned semi-variance data are aggregated before fitting the spherical variogram model; allowed values are mean, median (default), or maximum of the residuals within each separation bin.

  • [assumeZeroVarianceAtZeroLag] (default .false.) — If true, the variogram model is forced to go to zero for states with zero separation (as expected if the likelihood model being emulated is fully deterministic). Otherwise, the variance at zero separation is treated as a free parameter.