Fixed a bug when combining TimeFilter, MeshFilter, and tracklength estimator#3525
Conversation
|
@paulromano, as a reviewer of #3107, are you interested in reviewing this PR as well? |
|
Hi @GuySten - Thanks for directing me to this PR! I agree that this will address the issue in the use of the combination of mesh+time filters and tracklength estimators. I would recommend running a verification test, like using an analytical problem in #3107. This PR and #3107 effectively give equivalent effect and address the same issue. I think the decision on which one should be merged is really a trade-off that weighs in on the planning of the overall code design. While resulting in fewer code changes, this PR fixes the tally filtering issue by introducing operations into the main particle transport logic. On the other hand, #3107 isolates the equivalent operations only into the most relevant parts of the code (tally filter), hiding them from the main particle transport logic. (I think, to an extent, this is also part of the reasoning of the creation of a specialized |
|
Thanks @ilhamv for your thoughts about this PR! Your comment summarize the main differences between the two aproaches to the same issue. There are also some other benefits to my approach:
I also tried to minimize additional overhead when no time boundaries are needed. I think the ultimate decision should be at the core devs hands. |
|
Thanks @GuySten for emphasizing the benefits of the approach. Note that
|
paulromano
left a comment
There was a problem hiding this comment.
@ilhamv @GuySten Many thanks to you both for the two contrasting approaches and for the friendly dialogue around the pros and cons of each approach. My gut instinct is that I lean toward the TimedMeshFilter approach for the reasons elucidated by @ilhamv but I'm not yet set on this and I'd like to take a closer look at both PRs before making a final decision.
I'll note that in the case of MeshMaterialFilter there is an additional motivation to minimize the total number of bins. Using a combination of MeshFilter and MaterialFilter would result in the Cartesian product of all mesh and material bins when most combinations are irrelevant for common use cases. Although the same idea may hold here (the Cartesian product of time and mesh bins is very sparse), I don't think there's a way we can exploit that since, unlike the mesh-material case, there is no a priori knowledge on what combinations would get hit (this is the point where @pshriwise chimes in to tell us that we ought to have sparse tallies 😄).
a61651b to
868ef88
Compare
97916c0 to
9f12bc3
Compare
…move particle between time boundaries in the tally scoring section
52f05db to
ae31b24
Compare
|
@ilhamv and @paulromano, after reading your concerns about touching the transport logic, I added another commit that restructured the code in a way that only the tallying section is affected and the main transport logic remain unchanged. Under the hood the particle is moved back and forth in the tallying routines but in the end it returns to its correct place. I think this change address the main concerns you had so I am happy to hear your thoughts on the new code structure. |
|
Thanks, @GuySten, for continuing to look for alternatives for this!
The only downside that I can see relative to the Howver, I now noticed a downside of the So, @paulromano, I think I like this approach better. If you agree, I'll go ahead and close #3107. Nevertheless, we should still verify this approach against a test problem (like the AZURV1 in #3107). Feel free to let me know if you need help with that, @GuySten. |
|
@ilhamv, Thank you for your thoughts about the new approach! Regarding the time grid, the add_to_time_grid function already support sorting and removing repeating items from the time grid. I tried to run your AZURV1 problem according to your verification script but your script does not generate the reference solution. Maybe you can include the scripts needed to generate your nice time dependent plots or at least the script to generate the reference solution. |
|
I found the script to generate the reference solution: |
|
Found it! |
|
Thanks @ilhamv for the scripts! I have run the script, and it looks great: collision estimate:tracklength estimate: |
d4deb58 to
d394879
Compare
|
@paulromano, could you take some time to review the new approach? |
paulromano
left a comment
There was a problem hiding this comment.
Many thanks to both @GuySten and @ilhamv for the work on this issue! This solution is indeed quite elegant and I'm happy to merge it. I went through and made a few stylistic updates. I also updated the test to use a chi-squared test instead of comparing values within 3σ (which would result in more random test failures). @GuySten if you're OK with the changes, please feel free to hit the auto-merge button.
…timator (openmc-dev#3525) Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
…timator (openmc-dev#3525) Co-authored-by: Paul Romano <paul.k.romano@gmail.com>


Description
This PR change the particle advance method to stop at time boundaries so the combination of time filter, mesh filter and tracklength estimator works correctly.
This work is inspired by PR #3107 and solves the same issues in a different way.
Checklist
I have followed the style guidelines for Python source files (if applicable)I have made corresponding changes to the documentation (if applicable)