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

Implement filter for cosine of angle of surface crossing #2768

Merged
merged 22 commits into from
Oct 4, 2024

Conversation

zoeprieto
Copy link
Contributor

@zoeprieto zoeprieto commented Nov 10, 2023

Description

This PL addresses and resolves issue #2640 in the OpenMC repository, which pertains to the possibility of calculating the mu angular distribution of any surface current.
I have added a MuSurface filter to be able to calculate such a distribution when used with a SurfaceFilter.
Currently, the MuFilter only calculates the mu distribution for scattering angles and cannot be combined with a surface filter. On the other hand, the PolarFilter only calculates the polar angle distribution for a plane with the z-normal.
Therefore, this allows us to calculate the mu distribution for a current on any of the OpenMC surfaces.

Fixes #2640

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 for the PR @zoeprieto! Quick design question and then once we resolve that, I can review in full.

src/particle.cpp Outdated Show resolved Hide resolved
@zoeprieto
Copy link
Contributor Author

@paulromano sorry for the delay, I have already resolved the conflicts and pushing this PR again!

@paulromano paulromano changed the title Fix for Issue #2640: Resolve mu angular distributions of surface current Implement filter for cosine of angle of surface crossing Oct 3, 2024
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.

@zoeprieto Thanks for the updates here! I simplified the implementation considerably by simply inheriting from MuFilter (on both the C++ and Python sides). As you can see, this reduces the implementation in filter_musurface.cpp to <40 lines. I also added a simple regression test to augment what you had already added for a unit test.

@paulromano paulromano enabled auto-merge (squash) October 4, 2024 03:28
@paulromano paulromano merged commit c285a2c into openmc-dev:develop Oct 4, 2024
15 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.

Set particle.mu() at surface crossings.
2 participants