mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Address comments by @simondrichards
Also remove spaces between Raises entries in docstring of Element.expand
This commit is contained in:
parent
c679f8e8e1
commit
9078010d88
4 changed files with 38 additions and 16 deletions
|
|
@ -55,6 +55,20 @@ following would add 3.2% enriched uranium to a material::
|
|||
In addition to U235 and U238, concentrations of U234 and U236 will be present
|
||||
and are determined through a correlation based on measured data.
|
||||
|
||||
It is also possible to perform enrichment of any element that is composed
|
||||
of two naturally-occurring isotopes (e.g. Li, B) in terms of atomic percent.
|
||||
To invoke it, provide additional arguments `enrichment_target` to
|
||||
:meth:`Material.add_element`. For example the following would enrich B10
|
||||
to 30ao%::
|
||||
|
||||
mat.add_element('B', 1.0, enrichment=30.0, enrichment_target='B10')
|
||||
|
||||
In order to enrich an isotope in terms of mass percent (wo%). Provide extra
|
||||
argument `enrichment_type`. For example the following would enrich Li6 to 15wo%::
|
||||
|
||||
mat.add_element('Li', 1.0, enrichment=15.0, enrichment_target='Li6',
|
||||
enrichment_type='wo')
|
||||
|
||||
Often, cross section libraries don't actually have all naturally-occurring
|
||||
isotopes for a given element. For example, in ENDF/B-VII.1, cross section
|
||||
evaluations are given for O16 and O17 but not for O18. If OpenMC is aware of
|
||||
|
|
|
|||
|
|
@ -78,25 +78,19 @@ class Element(str):
|
|||
------
|
||||
ValueError
|
||||
No data is available for any of natural isotopes of the element
|
||||
|
||||
ValueError
|
||||
If only some natural isotopes are avaiable in cross-sections data
|
||||
library and element is not O, W or Ta
|
||||
|
||||
ValueError
|
||||
Enrichment of isotope which is not present in natural composition
|
||||
of the element is requested
|
||||
|
||||
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.
|
||||
|
|
@ -112,7 +106,7 @@ class Element(str):
|
|||
|
||||
When the `enrichment` argument is specified with `enrichment_target` a
|
||||
general enrichment procedure is used. It will raise exception unless
|
||||
element is composed of excatly 2 isotopes. `enrichment` is interpreted
|
||||
element is composed of exactly 2 isotopes. `enrichment` is interpreted
|
||||
as percent. By default it is atomic. Can be controlled by variable
|
||||
`enrichment_type`.
|
||||
|
||||
|
|
@ -241,11 +235,21 @@ class Element(str):
|
|||
# Interpret required enrichment as weight
|
||||
elif enrichment is not None and enrichment_target is not None:
|
||||
|
||||
# Check if is a single isotope mixture
|
||||
# Provide more informative error message for U235
|
||||
if enrichment_target == 'U235':
|
||||
msg = "There is a special procedure for enrichment of U235 "\
|
||||
"in U. To invoke it do not specify neither "\
|
||||
"'enrichment_target' nor 'enrichment_type'. Provide "\
|
||||
"only enrichment as 'wo%'. See User Guide for more "\
|
||||
"details"
|
||||
raise ValueError(msg)
|
||||
|
||||
# Check if it is two-isotope mixture
|
||||
if len(abundances) != 2:
|
||||
msg = 'Element {0} does not consist of 2 isotopes. Thus it '\
|
||||
'cannot be enriched with in-build procedure. Please '\
|
||||
'enter isotopic abundances manually. '.format(self)
|
||||
msg = 'Element {0} does not consist of 2 naturally-occurring '\
|
||||
'isotopes. Therefore it cannot be enriched with the '\
|
||||
'in-build procedure. Please enter isotopic abundances '\
|
||||
'manually.'.format(self)
|
||||
raise ValueError(msg)
|
||||
|
||||
# Check if the target nuclide is present in the mixture
|
||||
|
|
|
|||
|
|
@ -529,7 +529,7 @@ class Material(IDManagerMixin):
|
|||
Notes
|
||||
-----
|
||||
General enrichment procedure is allowed only for elements composed of
|
||||
two isotopes. If `enrichment_target` is given withou `enrichment`
|
||||
two isotopes. If `enrichment_target` is given without `enrichment`
|
||||
natural composition is added to the material.
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from openmc.data import NATURAL_ABUNDANCE, atomic_mass
|
|||
TOL = 1e-9
|
||||
|
||||
|
||||
def test_expand_no_ernichment():
|
||||
def test_expand_no_enrichment():
|
||||
""" Expand Li in natural compositions"""
|
||||
lithium = openmc.element.Element('Li')
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ def test_expand_no_ernichment():
|
|||
for isotope in lithium.expand(100.0, 'ao'):
|
||||
assert isotope[1] == pt.approx(NATURAL_ABUNDANCE[isotope[0]] * 100.0, rel=TOL)
|
||||
|
||||
# Verify the expanction into WEIGHT fraction against natural composition
|
||||
# Verify the expansion into WEIGHT fraction against natural composition
|
||||
natural = {'Li6': NATURAL_ABUNDANCE['Li6'] * atomic_mass('Li6'),
|
||||
'Li7': NATURAL_ABUNDANCE['Li7'] * atomic_mass('Li7')}
|
||||
li_am = sum(natural.values())
|
||||
|
|
@ -41,7 +41,7 @@ def test_expand_enrichment():
|
|||
|
||||
|
||||
def test_expand_exceptions():
|
||||
""" Test that correct exceptions are raiused for invalid input """
|
||||
""" Test that correct exceptions are raised for invalid input """
|
||||
|
||||
# 1 Isotope Element
|
||||
with pt.raises(ValueError):
|
||||
|
|
@ -71,5 +71,9 @@ def test_expand_exceptions():
|
|||
# Invalid Enrichment Type Entry
|
||||
with pt.raises(ValueError):
|
||||
element = openmc.element.Element('Li')
|
||||
fail = element.expand(70.0, 'ao', 4.0, 'Li7','Grand Moff Tarkin')
|
||||
fail = element.expand(70.0, 'ao', 4.0, 'Li7', 'Grand Moff Tarkin')
|
||||
|
||||
# Trying to enrich Uranium
|
||||
with pt.raises(ValueError):
|
||||
element = openmc.element.Element('U')
|
||||
fail = element.expand(70.0, 'ao', 4.0, 'U235', 'wo')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue