Skip to content

Configuration Reference

Thor uses YAML configuration files. This page documents all available options.

File Structure

# Global settings
## Required
dataset_type: 'shellmodel'
driver_type: 'mcrtsimulation'

## Optional
device: "cpu"          # options: "cpu", "cpu-openmp", "gpu", "multigpu"
log_level: info        # options: trace, debug, info, warn, error
log_dir: "./logs"

# Dataset section (name must match dataset_type)
shellmodel:
  # ...

Global Settings

Parameter Type Default Description
dataset_type string required Dataset geometry type
driver_type string required Simulation driver
device string SYCL default Compute device (see Device Options)
selftest bool true Run device self-tests at startup
log_level string "debug" Logging verbosity
log_dir string "./logs" Log output directory

Device Options

Value Description
"cpu" Default SYCL CPU selector
"cpu-openmp" Explicitly select the OpenMP CPU backend (recommended for AdaptiveCpp/acpp builds)
"gpu" SYCL GPU selector
"multigpu" Multi-GPU with one MPI rank per GPU (requires matching rank count and GPU count per node). Not yet broadly supported.

Tip

When building with -DACPP_TARGETS="omp", use "cpu-openmp" to ensure the OpenMP backend is selected instead of the generic SSCP CPU backend.

Dataset Types

  • shellmodel - Spherical shell
  • powerlaw_shellmodel - Power-law shell profiles
  • unigrid - Uniform Cartesian grid
  • infiniteslab - Infinite slab
  • pointcloud_voronoi - Voronoi tessellation (experimental)
  • pointcloud_voronoi_tree - Tree-accelerated Voronoi (incomplete)
  • pointcloud_sph - SPH interpolation (incomplete)

Driver Types

  • mcrtsimulation - Monte Carlo Radiative Transfer
  • raytracer - Forward ray tracing (projections, absorption spectra, tracers, etc)

MCRT Simulation Settings

mcrtsimulation:
  outputpath: output
  overwrite: true
  linename: Lya

  # Photon control
  nphotons_max: 100000
  nphotons_step_max: 100000
  nsteps_per_photon_max: 10000000

  # Physics
  xcrit: 3.0
  acc_scheme: Smith15
  interactor: ResonantWithDustInteractor

  # Stepping
  max_step: 1.0
  min_step: 0.0

  # Boundary conditions
  pbc: false
  hubble_flow: 300.0       # km/s/Mpc (for cosmological simulations)

  # Peeling
  use_peeling: true
  peeling:
    dist_max: 0.6
    tau_max: 100.0

  # Emission model
  emissionmodel:
    # ...

  # Output processors
  outputprocessors:
    # ...

MCRT Parameters

Parameter Type Default Description
outputpath string required Output directory
overwrite bool false Overwrite existing output
linename string required Resonant line to simulate (see Line Names)
nphotons_max int 1000000 Max photons in memory
nphotons_step_max int 1000000 Max photons spawned per step
nsteps_per_photon_max int 1000000000 Max steps per photon
xcrit float 0.0 Forced critical frequency for line wings
acc_scheme string "none" Acceleration scheme
interactor string - Interaction model
min_step float 0.0 Minimum step length (not honored by all dataset types)
max_step float 1.0 Maximum step length
max_dlambda float - Maximum wavelength bin shift per step
pbc bool false Periodic boundary conditions
hubble_flow float - Hubble flow velocity (km/s/Mpc)
use_peeling bool false Enable peeling photons

Line Names

The linename selects the resonant line to simulate. It determines the scattering cross-section, the ion density field that drives opacity, and which Cloudy emission/absorption fields to load. Use one of the following abbreviations:

Abbreviation Line Notes
Lya Lyman-alpha (H I 1215.67 A)
MgII Mg II doublet (2796 + 2803 A) Requires Cloudy tables. Use with ResonantDoubletInteractor for doublet treatment
FeXXV Fe XXV (1.85 A) Requires Cloudy tables
OVII O VII (21.60 A) Requires Cloudy tables

Note

Only Lya and FeXXV are currently supported with pointcloud_voronoi datasets. MgII and OVII density field mappings are not yet implemented for point cloud datasets, but work with analytical datasets (e.g. shellmodel, unigrid).

Acceleration Schemes

Only use values other than none with Lyman-alpha.

Value Description
none No acceleration
Smith15 Smith et al. 2015
Laursen09 Laursen et al. 2009

Interactors

Value Description
SimpleInteractor Basic resonant scattering
ResonantWithDustInteractor Includes dust absorption
ResonantDoubletInteractor Doublet lines (e.g., MgII)

Debug Settings

Optional settings for diagnosing photons that may be stuck in infinite loops:

mcrtsimulation:
  debug:
    stuck_photon_print: true
    stuck_photon_finish: false
Parameter Type Default Description
stuck_photon_print bool false Log warnings when photons exceed nsteps_per_photon_max
stuck_photon_finish bool false Force flagged photons to finish (for debugging only)

A photon is flagged as "potentially stuck" when it exceeds nsteps_per_photon_max steps within a single kernel invocation. This is a heuristic, not a definitive indicator—in high-density regions, a photon may legitimately undergo many scatterings before escaping. The flag simply identifies photons that have taken an unusually high number of steps.

Actual stuck photons are typically caused by geometric edge cases (e.g., photons trapped at cell boundaries or tangent to spherical shells) or numerical precision issues where the photon makes near-zero progress per step.

When stuck_photon_print is enabled, the simulation logs:

  • The number of potentially stuck photons
  • Position and direction of the first flagged photon

Do not use stuck_photon_finish in production

The stuck_photon_finish option is strictly for debugging. It removes flagged photons from the simulation, which is useful for identifying where actual stuck photons occur and fixing the underlying geometric or numerical issue. However, using this option in production runs will bias results by incorrectly discarding photons that are physically scattering many times in high-density regions.

Peeling Settings

When use_peeling: true, peeling photons are generated at each scattering event and propagated towards the observer:

mcrtsimulation:
  use_peeling: true
  peeling:
    dist_max: 0.6       # maximum observer distance (box widths)
    tau_max: 100.0       # maximum optical depth before discarding peel
Parameter Type Default Description
dist_max float - Maximum distance for peeling rays (in box widths)
tau_max float 30.0 Optical depth threshold; peeling photons above this are discarded

Emission Models

Single Source

emissionmodel:
  mode: "singlesource"
  singlesource:
    nphotons: 1000
    lum_total: 1e42
    position: [0.5, 0.5, 0.5]
    forced_weight: 1.0  # optional

List Source

emissionmodel:
  mode: "listsource"
  listsource:
    loader: gadget
    nphotons_per_source_min: 1
    nphotons_per_source_max: 1000

Dataset Source

emissionmodel:
  mode: "datasetsource"
  datasetsource:
    # Uses emission field from dataset loader

Output Processors

We allow for different raw and processed outputs. The most commonly used output format for now is the raw Monte Carlo photon output.

Each processor entry supports the following common parameters:

Parameter Type Default Description
type string required Processor type ("photon", "histogram1d", "sbmap", etc.)
active bool true Enable/disable this processor
streams list of strings all streams Restrict processor to specific photon streams

Stream Filtering

THOR runs up to three photon streams: original (escaped photons), peel (peeling-off photons), and input (initial photon state). By default, each output processor is active for all streams. The streams parameter restricts a processor to specific streams:

outputprocessors:
  - type: "photon"
    active: true

  - type: "sbmap"
    streams: ["peel"]        # only process peeling photons (default for sbmap)
    nbins_x: 64
    nbins_y: 64
    left_x: 0.0
    right_x: 1.0
    left_y: 0.0
    right_y: 1.0
    weight: "weight"

  - type: "histogram1d"
    # no streams → active for all streams
    field: "dlambda"
    weight: "weight"
    left: -1.5
    right: 1.5
    nbins: 30
    assess_convergence: true
    convergence_threshold: 0.1

Some processors have built-in defaults: sbmap defaults to streams: ["peel"] since it infers the line of sight from the photon direction, which is only well-defined for peeling photons.

Photon Output

Writes escaped photon data to HDF5.

Parameter Type Description
active bool Enable this processor

Histogram 1D

Experimental

This feature is experimental and may change.

Bins photon field values into a histogram (e.g., spectrum).

Parameter Type Description
field string Field to histogram (e.g., "dlambda")
weight string Weight field (e.g., "weight")
left float Left bin edge
right float Right bin edge
nbins int Number of bins
assess_convergence bool Check convergence
convergence_threshold float Convergence tolerance

Surface Brightness Map (sbmap)

Experimental

This feature is experimental and may change.

Projects photon positions onto a 2D image plane perpendicular to the line of sight. Produces an HDF5 dataset at /sbmap/image.

Parameter Type Default Description
nbins_x int required Number of pixels in x
nbins_y int required Number of pixels in y
left_x float required Left edge of image in x
right_x float required Right edge of image in x
left_y float required Left edge of image in y
right_y float required Right edge of image in y
weight string "weight" Weight field (currently only "weight" supported)
north vec3 [0, 0, 1] North hint vector for image orientation
line_of_sight vec3 (from photons) Explicit LOS direction (required for non-peel streams)
streams list ["peel"] Allowed streams (defaults to peel-only)

The image frame is computed from the line of sight direction and the north hint vector. By default, the LOS is inferred from the first photon's direction, which is correct for peeling photons (all share the same direction). For non-peel streams, provide an explicit line_of_sight and override streams.

Dataset-Specific Configuration

See Datasets for detailed configuration of each dataset type.