-
Notifications
You must be signed in to change notification settings - Fork 466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make random number stride user-configurable #2993
Comments
Hi Paul, I am Arief the first author of the article. Can I take a go at this? |
Hi @ahman24, it was great to discuss this with Dr. Fynan at the latest ANS meeting! If you haven't already implemented it, it may also be useful to print a warning to the user if the stride is exceeded. |
Hi @ethankrammer, We already had a local branch that implements random number usage counter and throw warning whenever the stride is exceeded, but I am currently on a vacation. For now, we will submit a PR only for user-configurable stride and submit a follow up PR later after my vacation. |
Description
Several papers/reports in the literature have documented that the limited PRNG stride in Monte Carlo codes can negatively impact results. For example, see the paper by Hakim and Fynan as well as the recent technical report by @cjosey. Currently, OpenMC uses a fixed stride of 152,917:
openmc/src/random_lcg.cpp
Line 13 in cfe210d
For some problems (highly scattering media, deep penetration fixed source with variance reduction, subcritical multiplication with k close to 1), the stride in OpenMC would be easily exceeded, which calls into question the reliability of the results. At a minimum, we should allow the stride to be user-configurable so that for these types of problems, one can at least choose a longer stride.
Other Considerations
Since the total period of the PRNG is fixed, picking a longer stride means that the effective period between source particles is reduced. Longer term, for very large problems we probably ought to adopt a PRNG with a longer period to handle problems with lots of source particles.
Compatibility
We can make the stride user-configurable while maintaining the default value, which means there won't be any compatibility issues or changes in test results.
The text was updated successfully, but these errors were encountered: