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

added check to length of input args for IndependantOperator #2799

Merged

Conversation

shimwell
Copy link
Member

@shimwell shimwell commented Dec 8, 2023

Description

I noticed it is easy to pass incorrect length arguments to Independent Operator and found myself passing in flux groups instead of single flux values.

After reading the docs string more carefully I now realise that the length of fluxes, micros and materials should all be the same.

Passing in a longer flux with extra values does not actually cause an error in the code, it just continues without a crash.

So it is a bit too easy to add in a flux spectra here without noticing. I added in a check that will catch the input error and a test to test the error handling.

Many thanks to @jbae11

Fixes # (issue)

Checklist

  • I have performed a self-review of my own code
  • 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)

@shimwell
Copy link
Member Author

shimwell commented Dec 8, 2023

I'm suspicious of this line that gets the length of flux but not energy and doesn't check if they are the same

@jbae11
Copy link
Contributor

jbae11 commented Dec 12, 2023

nice! Thanks for this @shimwell

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.

Another one good to go. Thanks!

@paulromano paulromano enabled auto-merge (squash) December 12, 2023 19:56
@paulromano paulromano merged commit 552adc0 into openmc-dev:develop Dec 12, 2023
17 checks passed
church89 pushed a commit to openmsr/openmc that referenced this pull request Jul 18, 2024
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