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¶
iterator→voidReturn an iterator which can be used to iterate over the domain.
class(domainIterator), intent(inout), allocatable :: iterator
initialize→voidInitialize the computational domain, setting up internal data structures and allocating resources required before radiative transfer iterations begin.
reset→voidReset 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.
indicesFromPosition→voidReturn 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 ) :: positioninteger (c_size_t), allocatable, dimension(:), intent(inout) :: indices
absorptionCoefficient→double precisionReturn 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) :: photonPacketinteger(c_size_t ), dimension(:), intent(in ) :: indices
lengthToCellBoundary→double precisionReturn the length until a photon packet hits a cell boundary. Also return the indices of that neighboring cell.
class (radiativeTransferPhotonPacketClass) , intent(inout) :: photonPacketinteger (c_size_t ) , dimension(:), intent(in ) :: indicesinteger (c_size_t ), allocatable, dimension(:), intent(inout) :: indicesNeighbordouble precision , dimension(3), intent( out) :: positionBoundary
accumulatePhotonPacket→voidAccumulate “absorptions” from the photon packet as it traverses a cell of the computational domain.
class (radiativeTransferPhotonPacketClass) , intent(inout) :: photonPacketinteger (c_size_t ), dimension(:), intent(in ) :: indicesdouble precision , intent(in ) :: absorptionCoefficient, lengthTraversed
interactWithPhotonPacket→logicalInteract 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) :: photonPacketinteger (c_size_t ), dimension(:), intent(inout) :: indices
stateSolve→voidSolve 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.
converged→logicalReturn 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.
output→voidOutput 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](default0.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](default2.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](default1.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](default0.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](default2.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](default1.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](default1.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](default3_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](default0.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](default2.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](default1.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](defaultvar_str('median')) — Option controlling how the binned semi-variance data are aggregated before fitting the spherical variogram model; allowed values aremean,median(default), ormaximumof 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.