mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Add exception for U enrichment with type 'ao'
Remove a confusing comment.
This commit is contained in:
parent
d17b38ba5e
commit
196c4a0735
3 changed files with 17 additions and 8 deletions
|
|
@ -36,7 +36,7 @@ class Element(str):
|
|||
return self
|
||||
|
||||
def expand(self, percent, percent_type, enrichment=None,
|
||||
enrichment_target=None, enrichment_type='ao',
|
||||
enrichment_target=None, enrichment_type=None,
|
||||
cross_sections=None):
|
||||
"""Expand natural element into its naturally-occurring isotopes.
|
||||
|
||||
|
|
@ -87,13 +87,11 @@ class Element(str):
|
|||
ValueError
|
||||
Enrichment is requested of the element that is not composed of
|
||||
two isotopes.
|
||||
ValueError
|
||||
If `enrichment_type` is not 'ao' or 'wo'
|
||||
ValueError
|
||||
If `enrichment` is outside <0;100> range
|
||||
ValueError
|
||||
If enrichment procedure for Uranium is used when element is not
|
||||
Uranium.
|
||||
ValueError
|
||||
Uranium enrichment is requested with enrichment_type=='ao'
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
|
@ -112,7 +110,8 @@ class Element(str):
|
|||
|
||||
"""
|
||||
# Check input
|
||||
cv.check_value('enrichment_type', enrichment_type, {'ao', 'wo'})
|
||||
if enrichment_type is not None:
|
||||
cv.check_value('enrichment_type', enrichment_type, {'ao', 'wo'})
|
||||
|
||||
if enrichment is not None:
|
||||
cv.check_less_than('enrichment', enrichment, 100.0, equality=True)
|
||||
|
|
@ -215,6 +214,12 @@ class Element(str):
|
|||
'but the isotope is {0} not U'.format(self)
|
||||
raise ValueError(msg)
|
||||
|
||||
# Check that enrichment_type is not 'ao'
|
||||
if enrichment_type == 'ao':
|
||||
msg = 'Enrichment procedure for Uranium requires that '\
|
||||
'enrichment value is provided as wo%.'
|
||||
raise ValueError(msg)
|
||||
|
||||
# Calculate the mass fractions of isotopes
|
||||
abundances['U234'] = 0.0089 * enrichment
|
||||
abundances['U235'] = enrichment
|
||||
|
|
@ -232,7 +237,6 @@ class Element(str):
|
|||
|
||||
# Modify mole fractions if enrichment provided
|
||||
# New treatment for arbitrary element
|
||||
# Interpret required enrichment as weight
|
||||
elif enrichment is not None and enrichment_target is not None:
|
||||
|
||||
# Provide more informative error message for U235
|
||||
|
|
|
|||
|
|
@ -500,7 +500,7 @@ class Material(IDManagerMixin):
|
|||
self._macroscopic = None
|
||||
|
||||
def add_element(self, element, percent, percent_type='ao', enrichment=None,
|
||||
enrichment_target=None, enrichment_type='ao'):
|
||||
enrichment_target=None, enrichment_type=None):
|
||||
"""Add a natural element to the material
|
||||
|
||||
Parameters
|
||||
|
|
|
|||
|
|
@ -77,3 +77,8 @@ def test_expand_exceptions():
|
|||
with pt.raises(ValueError):
|
||||
element = openmc.element.Element('U')
|
||||
fail = element.expand(70.0, 'ao', 4.0, 'U235', 'wo')
|
||||
|
||||
# Trying to enrich Uranium with wrong enrichment_target
|
||||
with pt.raises(ValueError):
|
||||
element = openmc.element.Element('U')
|
||||
fail = element.expand(70.0, 'ao', 4.0, enrichment_type='ao')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue