Skip to content

ww_bounds bug fix in setter and getter - #2275

Merged
pshriwise merged 5 commits into
openmc-dev:developfrom
eepeterson:ww_bugfix
Oct 25, 2022
Merged

pshriwise merged 5 commits into
openmc-dev:developfrom
eepeterson:ww_bugfix

Conversation

@eepeterson

Copy link
Copy Markdown
Contributor

Simple bug fix for a place we were intending to modify an array, but were not. Namely bounds.reshape doesn't modify the array in place.

@shimwell

Copy link
Copy Markdown
Member

Thanks for this fix @eepeterson
I was thinking is it worth adding a unit test to protect against this bug returning in the future.
If you are keen on a unit test then I've made a PR against your branch eepeterson#1

Comment thread openmc/weight_windows.py Outdated
@shimwell

Copy link
Copy Markdown
Member

The code looks fine to me, just to check my understanding, is this reshape needed when using WW with multiple energy groups

@eepeterson

Copy link
Copy Markdown
Contributor Author

@shimwell this is essentially just fixing the from_xml method of the WeightWindows class. If you read in weight windows from a settings.xml file into a python script the indexing will be wrong (transposed to what it should be). If you did happen to write them out again they will not be ordered in the way the openmc executable assumes.

@shimwell shimwell self-assigned this Oct 25, 2022
@shimwell

shimwell commented Oct 25, 2022 •

Copy link
Copy Markdown
Member

Thanks Ethan this might explain why the minimal magic script @pshriwise and myself have been looking into has been struggling with improving the ww on each iteration as we read in the settings.xml after writing it each loop

@pshriwise pshriwise left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this fix, @eepeterson!

@pshriwise
pshriwise merged commit 781603b into openmc-dev:develop Oct 25, 2022
@pshriwise

Copy link
Copy Markdown
Contributor

Thanks Ethan this might explain why the minimal magic script @pshriwise and myself have been looking into has been struggling with improving the ww on each iteration as we read in the settings.xml after writing it each loop

I think this is fixing a read into Python from XML as opposed to fixing a read into the C++ API. I've had success generating WWs with multiple energy groups on several models with that script as-is. I think our ww gen problem may have more to do with an instantiation of a Numpy array as integers rather than floats -- a change that I have in my branch on this but not that gist I sent you. My bad!

apingegno pushed a commit to apingegno/openmc that referenced this pull request May 7, 2026
ww_bounds bug fix in setter and getter
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.

3 participants