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

Updates to object lifecycle for WeightWindows and WeightWindowGenerators #2582

Merged
merged 5 commits into from
Jul 1, 2023

Conversation

pshriwise
Copy link
Contributor

Description

This PR includes some updates to the C++ WeightWindows and WeightWindowsGenerator objects to resolve an issue clashing ID spaces between automatically created tallies for weight window generation and user-specified tallies. The weight window generation tallies are now created after reading in all user-specified filters and tallies so that the generator tally uses new ID space. This involved a simple refactor of the WeightWindowsGenerator constructor and a call to setup these tallies once all other simulation initialization is complete.

I've added an additional tally in the weight window generation regression test to ensure this problem is checked in CI.

There are a couple of other housekeeping items I took care of as well:

  • allocation of weight window bounds now only occurs once the mesh is set and it is updated when the WeightWindow::set_mesh/set_energy_bounds methods are called.
  • The WeightWindows::mesh_idx_ data member is initialized to -1 to ensure an error occurs if the weight windows are used without the mesh being set. Before, this value could initialize to 0 and use the first mesh in the model without complaint.
  • The WeightWindows.energy_bounds attribute was not initialized correctly in the case that. I've added a check for this as well.

Checklist

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

Copy link
Contributor

@eepeterson eepeterson 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 great stuff here @pshriwise! I ended up making more comments than I thought I would so if you're up for some changes now that's great otherwise these comments can be addressed in another PR.

include/openmc/weight_windows.h Outdated Show resolved Hide resolved
include/openmc/weight_windows.h Outdated Show resolved Hide resolved
openmc/weight_windows.py Show resolved Hide resolved
openmc/weight_windows.py Show resolved Hide resolved
src/weight_windows.cpp Show resolved Hide resolved
src/weight_windows.cpp Show resolved Hide resolved
src/weight_windows.cpp Show resolved Hide resolved
src/weight_windows.cpp Show resolved Hide resolved
tests/regression_tests/weightwindows/generators/test.py Outdated Show resolved Hide resolved
tests/unit_tests/weightwindows/test.py Show resolved Hide resolved
@eepeterson eepeterson merged commit 382bcb2 into openmc-dev:develop Jul 1, 2023
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.

2 participants