13–17 Apr 2026
Clarion Hotel Malmö Live
Europe/Stockholm timezone

Multiple time sampling for Monte Carlo ray-tracing instrument simulations

13 Apr 2026, 16:00
20m
Live 1 (Clarion Hotel Malmö Live)

Live 1

Clarion Hotel Malmö Live

Oral Presentation Technical talks

Speaker

Mads Bertelsen (European Spallation Source ERIC)

Description

Design of neutron scattering instruments has, in recent decades, benefited significantly from Monte Carlo ray-tracing simulations, enabling rapid evaluation and optimization of instrument performance. Even neutron source design has been optimized in conjunction with instrument performance [1]. Although instrument simulations are computationally less demanding than full source simulations, the parameter space remains vast, and computational cost continues to limit optimization. Achieving simulation throughput comparable to real measurement times is still prohibitively expensive in many cases.

Recent performance improvements have largely been driven by advances in hardware and porting to accelerators such as GPUs, while relatively few advances have addressed the underlying simulation methodology. One notable example is backtracing, as implemented in SIMRES, which is highly effective for small samples but has not been widely adopted in other simulation packages.

In this work, we present a simple but effective optimization for simulations of pulsed neutron sources. The method samples multiple emission times per neutron ray from each pulse. Since the emission time is often not required until specific components (e.g., choppers or time-resolving detectors), multiple time samples can be propagated within a single ray and only unpacked when needed. Most components handles the ray as usual without additional computational cost, resulting in a substantial overall speedup.

A prototype implementation was developed in McStas [2] and evaluated using the ESS instruments ODIN and CSPEC. For simple cases, the computational speed of the ray-tracing section became several times faster. In more complex scenarios, such as wavelength frame multiplication (WFM), speedups of 5–25× were observed, depending on resolution, even when considering only ray count. When fully exploiting the additional time information, a consistent speedup of approximately 30× was achieved across resolutions. For instruments with late choppers and low acceptance rates, performance gains are even larger: on CSPEC, improvements exceeding two orders of magnitude were observed, as most rays contain at least one valid emission time.

This contribution presents the implementation details of the method and provides guidance for adapting McStas components to support it. The approach is general and is expected to yield similar performance improvements in other neutron ray-tracing frameworks.

[1] Holst Andersen, K., Bertelsen, M., Zanini, L., Klinkby, E. B., Schonfeldt, T., Bentley, P. M., & Saroun, J. (2018). Optimization of moderators and beam extraction at the ESS. Journal of Applied Crystallography, 51(2), 264-281. doi.org/10.1107/S1600576718002406

[2] Willendrup, P., Lefmann, K. McStas (i): Introduction, use, and basic principles for ray-tracing simulations. Journal of Neutron Research. 2020;22(1):1-16. doi:10.3233/JNR-190108

Author

Mads Bertelsen (European Spallation Source ERIC)

Co-author

Peter Willendrup (ESS DMSC and DTU Physics)

Presentation materials

There are no materials yet.