Skip to content

Added checks that tolerance value is between 0 and 1 - #2884

Merged
pshriwise merged 1 commit into
openmc-dev:developfrom
rlbarker:check_tolerance_value_in_clip
Feb 26, 2024
Merged

pshriwise merged 1 commit into
openmc-dev:developfrom
rlbarker:check_tolerance_value_in_clip

Conversation

@rlbarker

Copy link
Copy Markdown
Contributor

Description

While using material.get_decay_photon_energy() I realised that you can set the clip_tolerance to greater than 1 and the simulation will run. However this value should be a fraction. I have added 2 checks to the clip method that ensure the value is between 0 and 1 to protect against misuse in future. I have also added to the tests to confirm that these checks work.

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)

@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 @rlbarker! Nice addition

@pshriwise
pshriwise merged commit b3a2456 into openmc-dev:develop Feb 26, 2024
church89 pushed a commit to openmsr/openmc that referenced this pull request Jul 18, 2024
apingegno pushed a commit to apingegno/openmc that referenced this pull request May 7, 2026
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