Subgrid clouds
A subgrid section adds spherical clouds to a filled shellmodel sphere or
an infiniteslab. MCRT and RayTracer resolve each cloud surface and sample
the appropriate material along the path. The parent geometry retains its cell
IDs and outer boundaries.
The first material model is model: prescribed. Supply the cloud and background
H I density, temperature, bulk velocity, microturbulence and dust independently.
This model imposes no pressure balance, ionization equilibrium or conservation
relative to a pre-existing parent density. Redistribution of parent fields is a
separate planned model; model: redistribution currently produces an error.
Physical inputs
Place subgrid inside the selected dataset section. The parent then accepts
geometry inputs: boxsize, and for the sphere inner_radius: 0 and
outer_radius between zero and 0.5. Put all material inputs in the phase
sections; legacy parent density, temperature, velocity and dust settings
cannot be combined with the overlay.
| Setting | Meaning |
|---|---|
background.density, cloud.density |
H I number density in physical \(\mathrm{cm}^{-3}\); nonnegative |
temperature in either phase |
Positive temperature in K |
velocity |
Three bulk velocity components in cm/s; default [0, 0, 0] |
turbulent_velocity |
Microturbulent velocity in cm/s; default zero |
dust_extinction |
Extinction coefficient in \(\mathrm{cm}^{-1}\); default zero |
cell_size |
Search/generation grid spacing in physical cm |
transverse_period |
Slab cloud repetition width in both transverse axes, in cm; default boxsize |
Density and temperature must be supplied for both phases, including vacuum
backgrounds. The driver's usual temperature_floor applies to both phase
temperatures. Density and HIDensity return the same absorbing H I
population and carry the same species metadata.
Dust uses the existing interactor's scattering and absorption law.
dust_extinction is not a pure-absorption coefficient. Nonzero values require
a dust-capable interactor such as ResonantWithDustInteractor.
Physical lengths remain double precision through normalization by boxsize.
Cloud centres use physical centimetres measured from the box minimum. Source
positions and ray endpoints retain THOR's usual box coordinates.
Catalogue and procedural providers
Both providers use the same containment tests, sphere intersections, material evaluation and transport code.
For provider: catalogue, supply non-overlapping spheres with unique signed
integer keys:
subgrid:
model: prescribed
provider: catalogue
cell_size: 2.5e17
background: {density: 0.2, temperature: 10000}
cloud: {density: 2, temperature: 10000}
clouds:
- {key: [1, 0, 0], centre: [1e18, 1e18, 1.25e18], radius: 1e17}
- {key: [2, 0, 0], centre: [1e18, 1e18, 1.65e18], radius: 1e17}
This catalogue fits a sphere with boxsize: 2e18, inner_radius: 0
and outer_radius: 0.5. An empty clouds: [] selects background everywhere.
Search bins include spheres whose centres are in neighbouring bins.
For provider: procedural, omit clouds and set:
Keep the phase sections and cell_size from the preceding example. Generator
version 1 places one fixed-radius sphere at each occupied voxel centre.
occupancy is an independent voxel probability between zero and one; it is
not a volume filling fraction or covering factor. The radius must be smaller
than half the cell spacing, with enough margin to keep rounded centres
separated in the selected precision. Setup rejects insufficient margins;
reduce the radius or increase cell_size. Cloud radii are never shrunk
automatically.
The configured seed and full signed voxel coordinate determine occupancy;
photon random numbers and visit order do not affect the cloud realization.
Setting materialize: true stores that same realization as a catalogue with
the same keys. It is useful for comparisons and allocates the complete bounded
catalogue and search index.
Catalogue clouds must fit wholly inside the spherical parent. The procedural provider excludes any sphere that would protrude through its surface. This leaves a boundary-dependent filling fraction.
The procedural provider currently confines each cloud to its home voxel and queries only that voxel. Fixed voxel-centre positions introduce lattice correlations and may imprint preferred directions or encounter distances on transport results. This is a placement-model limitation: the provider does not yet support freely positioned, non-overlapping clouds that cross voxel faces. Supporting them requires both neighbour-aware lookup and overlap prevention. Explicit catalogues already support clouds crossing search-bin faces. Materializing the procedural population preserves its lattice correlations; agreement between those two representations does not validate random placement.
Radius limits
Both providers require radius / cell_size to be at least
\(128\sqrt{\epsilon}\), where \(\epsilon\) is the machine epsilon of the selected
simulation precision. This limits cancellation in sphere intersections.
| Precision | Minimum radius / cell_size |
|---|---|
| FP64 | \(1.90735 \times 10^{-6}\) |
| FP32 | \(0.0441942\) |
Setup rejects smaller radii with an error. Increase the radius or reduce
cell_size; coordinate-resolution checks also apply. For a catalogue, changing
cell_size changes the search index. For the procedural provider, it changes
the generation lattice and cloud population.
The radius in box coordinates must also be at least \(\sqrt{\mathrm{min}_{\mathrm{normal}}/\epsilon}\), so squared radii and surface residuals remain normal floating-point values. Radii and grid spacing in box coordinates must not exceed \(\sqrt{\mathrm{max}}/16\), reserving headroom for sphere-intersection arithmetic.
Grid bounds must reserve fractional bits for coordinate inversion: their absolute values must be less than \(2^{p-4}\), where \(p\) is the number of significand bits (24 for FP32, 53 for FP64). The separate setup limit of \(10^8\) cells per axis also applies. Periodic queries reject cell coordinates beyond the smaller of \(2^{p-4}-1\) and \(10^9\); transport aborts if a flight reaches unresolved geometry. Setup checks its limits before constructing either provider.
Infinite slab
The slab occupies 0 <= z <= boxsize in physical coordinates and remains
unbounded in x and y. The cloud realization repeats with transverse_period;
this does not alter the slab thickness or terminate a photon. World-space
photon positions are retained across transverse periods.
Catalogue centres must lie in the canonical transverse tile
[0, transverse_period). Clouds may cross its transverse edges; their periodic
images participate in overlap checks and ray intersections. Clouds must remain
inside the two slab faces. Periodic images retain the base cloud key.
cell_size must divide boxsize and the transverse period into integer
numbers of cells. The initial implementation rejects unresolved radii, invalid
coordinates, duplicate keys, overlapping spheres and unsupported index sizes.
Transport scope and validation
Use one MPI rank and pbc: false. Slab repetition is handled by the cloud
provider. Set min_step: 0; a positive minimum could skip a material surface.
MCRT also requires:
Keep continuum advancement disabled. Explicit point, list or plane sources can be used. Local thermal spectra sample the phase at each emitter's position before its travel direction is drawn. These position-only samples use the background phase within numerical tolerance of a cloud surface. Directional photon reads retain ownership on the outgoing side of the surface.
Gas emission from parent cells is not implemented. Per-parent-cell
populate mappings cannot replace prescribed phase fields. Voronoi composition,
distributed transport and redistribution remain later stages. Parent-cell array
statistics describe the backing geometry fields, not the cloud population. Use
resolved sightlines for cloud columns; volume-averaged phase diagnostics are
not implemented yet.
The Catch2 [subgrid] cases check independent sphere chords, partial flights,
direction changes at surfaces, field aliases, periodic images and identical
procedural/materialized geometry. The CI/subgrid regression checks exact
ray-traced columns on both parents and compares source and peel streams for
the same generated realization, including short kernel budgets. Photon identities,
scattering counts, wavelengths and directions must match exactly; accumulated
positions and peel opacity use a precision-scaled roundoff allowance.
These are transport and implementation checks. Literature comparisons, high-optical-depth homogeneous controls, transverse-period convergence and performance characterization require the subsequent scientific-validation work.