mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Enforce non-negative percents for material.add_nuclide to prevent unintended ao/wo flipping (#3075)
This commit is contained in:
parent
b11f8b73ca
commit
e74dc5037e
1 changed files with 2 additions and 0 deletions
|
|
@ -519,6 +519,7 @@ class Material(IDManagerMixin):
|
|||
cv.check_type('nuclide', nuclide, str)
|
||||
cv.check_type('percent', percent, Real)
|
||||
cv.check_value('percent type', percent_type, {'ao', 'wo'})
|
||||
cv.check_greater_than('percent', percent, 0, equality=True)
|
||||
|
||||
if self._macroscopic is not None:
|
||||
msg = 'Unable to add a Nuclide to Material ID="{}" as a ' \
|
||||
|
|
@ -727,6 +728,7 @@ class Material(IDManagerMixin):
|
|||
|
||||
cv.check_type('nuclide', element, str)
|
||||
cv.check_type('percent', percent, Real)
|
||||
cv.check_greater_than('percent', percent, 0, equality=True)
|
||||
cv.check_value('percent type', percent_type, {'ao', 'wo'})
|
||||
|
||||
# Make sure element name is just that
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue