Skip to content
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

Implementation of Shannon Entropy for Random Ray #3030

Merged
merged 19 commits into from
Jun 27, 2024

Conversation

ethankrammer
Copy link
Contributor

@ethankrammer ethankrammer commented Jun 6, 2024

Description

Shannon entropy is a method of diagnosing convergence for Monte Carlo eigenvalue problems. Prior to this PR, the Shannon entropy was only being computed in multigroup MC and not Random Ray. Since Random Ray also needs to converge the scattering source in addition to the eigenvalue, there is additional need for computing Shannon entropy in the Random Ray method.

Since the Random Ray implementation in OpenMC uses Flat Source Regions, we use these instead of a user-defined mesh to compute Shannon entropy. The implementation otherwise follows the same methodology for calculating Shannon entropy as other MC applications.

A regression test directory, random_ray_entropy, was also developed for this PR. Based on the cross-sections and geometry mesh given by Nowak et al., the Shannon entropy is calculated exactly as 9.0 and the eigenvalue as 1.0.

Small edits to the documentation were also made to reflect Shannon entropy being implemented into the Random Ray method in OpenMC.

The 2D C5G7 Random ray example was used for validation of the Shannon entropy implementation. Below is a plot of the eigenvalue and Shannon entropy calculated at each batch.

2D C5G7 Shannon Entropy Convergence

Fixes #2868

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 15) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@ethankrammer ethankrammer requested a review from jtramm as a code owner June 6, 2024 20:37
@ethankrammer
Copy link
Contributor Author

ethankrammer commented Jun 9, 2024

This PR has a known issue where Shannon entropy is not calculated correctly for problems with flat source regions (FSRs) of uneven volume. The regression test, random_ray_entropy, runs as expected, since the lattice builds FSRs of equal volume.

While calculating the "correct" value of Shannon entropy is not particularly useful, this issue may result in inaccurate convergence diagnostics for problems with large FSR volume differences. Essentially, the smaller FSRs may dominate the calculation of Shannon entropy, which would result in perceived convergence even if the larger FSRs have yet to converge.

Copy link
Contributor

@jtramm jtramm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @ethankrammer! This appears to be working nicely. I've made a few minor comments and requests for small changes, and then this should be in good shape to go in.

docs/source/methods/random_ray.rst Outdated Show resolved Hide resolved
docs/source/usersguide/random_ray.rst Outdated Show resolved Hide resolved
docs/source/usersguide/random_ray.rst Outdated Show resolved Hide resolved
src/random_ray/flat_source_domain.cpp Outdated Show resolved Hide resolved
src/random_ray/flat_source_domain.cpp Outdated Show resolved Hide resolved
src/random_ray/flat_source_domain.cpp Outdated Show resolved Hide resolved
src/random_ray/flat_source_domain.cpp Outdated Show resolved Hide resolved
src/settings.cpp Show resolved Hide resolved
@yardasol yardasol mentioned this pull request Jun 17, 2024
5 tasks
@jtramm
Copy link
Contributor

jtramm commented Jun 27, 2024

The changes all look good -- thanks @ethankrammer, and congrats on your first OpenMC PR!

@jtramm jtramm merged commit a8171cb into openmc-dev:develop Jun 27, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shannon Entropy for Random Ray
2 participants