Skip to content

Conversation

@jtramm
Copy link
Contributor

@jtramm jtramm commented Feb 24, 2025

Description

This PR makes a minor tweak that helps to improve the stability of the simulation when linear sources are being used.

When computing the linear source moments for each source region at the beginning of every power iteration, a check is now performed on the value of the flat source (0th order coefficient) to determine if it is negative. If the flat source value is negative, then the linear source coefficients are set to zero, essentially allowing the source region to decay from the linear source region into a flat source region. This has the effect of reducing instability arising from rarely hit (noisy) cells with poorly developed spatial moments. Note that we still allow the flat source term to remain negative, as setting that to zero tends to impart much more significant bias into the simulation as compared to simply decaying to a flat source approximation.

In practice, this change is only really noticeable when the source region miss rate (percentage of cells that received no ray crossings that iteration) is very high. We typically give a warning if the miss rate goes above 1%, though the improvement this PR adds really only impacts things at above a 10% miss rate.

At first glance, this makes it seem like a pointless change. However, the stability improvement will become important when the cell-under-voxel PR is introduced, which has the impact of generating a lot of small/noisy source regions that see much more benefit from this change. I am adding this change as a separate PR from the upcoming cell-under-voxel PR as the new policy here very slightly changes the flux tally results from the linear solver in a number of our CI tests, and I'd like to avoid having the cell-under-voxel PR change results for tests unrelated to meshing.

Validation

I ran tests on both the 2D C5G7 benchmark and 3D kobayashi dog leg. On these tests, I varied the number of rays per batch so as to adjust the cell miss rate per iteration, but otherwise left the parameters the same.

Kobayshi Dog Leg

For this problem, I report the flux in the farthest 10x10x10 cm^3 cell from the source:

Cell Miss Rate per Iteration MGMC Reference Old This PR
65% Miss 2.31E-05 4.17E-06 1.06E-05
1% Miss 2.31E-05 2.30E-05 2.30E-05

In the Kobyashi results above, we can see that there is really no change at the recommended 1% miss rate configuration, but when the ray density falls to result in a 65% miss rate, the new PR behavior does improve the accuracy. Still, a 65% miss rate is extreme, so there is no surprise that there is still a lot of error.

2D C5G7 Coarse Mesh

Configuration Metric Old This PR
20% Miss k-eff Unstable 1.18700 +/- 0.00080
Average Pin Error [%] 1.46
Max Pin Error [%] 7.63
15% Miss k-eff 1.18748 +/- 0.00081 1.18751 +/- 0.00069
Average Pin Error [%] 1.41 1.18
Max Pin Error [%] 18.54 10.63
1% Miss k-eff 1.18669 +/- 0.00038 1.18665 +/- 0.00038
Average Pin Error [%] 0.62 0.61
Max Pin Error [%] 2.92 2.93

The 2D C5G7 results show a much clearer benefit. Both the old and new policy do well at the 1% miss rate. At 15% miss rate, we start to see a significant increase in the maximum pin power error, with the old policy at 18% error and the new one at 10% error. At 20% miss rate, the old policy becomes completely unstable, whereas the new policy is able to maintain stability and produce a reasonable answer.

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)

Copy link
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

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

Thanks once again @jtramm

@paulromano paulromano enabled auto-merge (squash) February 24, 2025 16:20
@paulromano paulromano merged commit cba132c into openmc-dev:develop Feb 24, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants