Component Manual for the Neutron Ray-Tracing Package McStas, version 3.9

B.3  The propagation algorithm

This section gives a conceptual outline of how Union_master actually propagates rays; see the original thesis [Ber17] for the full derivation and pseudocode.

B.3.1  Basic Monte Carlo step

Within a volume, the distance to the next scattering position is drawn from the usual exponential distribution set by the total inverse penetration depth (sum over the volume’s absorption and all its processes’ scattering contributions). If this distance is less than the distance to the volume’s boundary, a scattering event occurs there; the specific process is chosen by a weighted Monte Carlo choice between the processes active in the current material (or forced via interact_fraction, in which case the ray weight is corrected to remain unbiased). Otherwise, the ray is propagated to the boundary and the simulation continues in whichever volume lies on the other side.

B.3.2  Intersection and destination lists

Naively, determining "the other side" of a boundary would require testing every other defined volume for intersection and containment, for every propagation step – prohibitively expensive once more than a handful of volumes are involved. Instead, in the initialize section of each Union_master, the whole ensemble of volumes is analysed once to build, for every volume \(n\):

This turns an \(O(N)\)-per-step cost (checking every volume) into something close to \(O(1)\) in typical geometries, and is what makes simulating sample environments built from dozens of volumes computationally practical. Figure B.2 sketches the resulting behaviour for a simple case.


PIC


Figure B.2.: Illustration of the Union propagation algorithm for a single scattering event between two overlapping volumes. Only intersections actually relevant given the ray’s current volume are calculated at each step (the orange volume, never reachable from the ray’s actual path here, is never tested).


B.3.3  Known limitations