mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Address comments by @paulromano
Use default rel_tol in pytest.approx in test_element.py Add info that default enrichment for U is in wo%
This commit is contained in:
parent
bcc4a52eb9
commit
adcb9347a7
3 changed files with 7 additions and 10 deletions
|
|
@ -62,7 +62,7 @@ class Element(str):
|
|||
Single nuclide name to enrich from a natural composition (e.g., 'O16')
|
||||
enrichment_type: {'ao', 'wo'}, optional
|
||||
'ao' for enrichment as atom percent and 'wo' for weight percent.
|
||||
Default is 'ao'
|
||||
Default is: 'ao' for two-isotope enrichment; 'wo' for U enrichment
|
||||
cross_sections : str, optional
|
||||
Location of cross_sections.xml file. Default is None.
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ class Element(str):
|
|||
When the `enrichment` argument is specified with `enrichment_target`, a
|
||||
general enrichment procedure is used for elements composed of exactly
|
||||
two naturally-occurring isotopes. `enrichment` is interpreted as atom
|
||||
percent by default but can be controlled by the `enrichment_type`
|
||||
percent by default but can be controlled by the `enrichment_type`
|
||||
argument.
|
||||
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -522,7 +522,7 @@ class Material(IDManagerMixin):
|
|||
Single nuclide name to enrich from a natural composition (e.g., 'O16')
|
||||
enrichment_type: {'ao', 'wo'}, optional
|
||||
'ao' for enrichment as atom percent and 'wo' for weight percent.
|
||||
Default is 'ao'
|
||||
Default is: 'ao' for two-isotope enrichment; 'wo' for U enrichment
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@ from pytest import approx, raises
|
|||
|
||||
from openmc.data import NATURAL_ABUNDANCE, atomic_mass
|
||||
|
||||
# Relative tolerance for float comparison
|
||||
TOL = 1e-9
|
||||
|
||||
|
||||
def test_expand_no_enrichment():
|
||||
""" Expand Li in natural compositions"""
|
||||
|
|
@ -13,7 +10,7 @@ def test_expand_no_enrichment():
|
|||
|
||||
# Verify the expansion into ATOMIC fraction against natural composition
|
||||
for isotope in lithium.expand(100.0, 'ao'):
|
||||
assert isotope[1] == approx(NATURAL_ABUNDANCE[isotope[0]] * 100.0, rel=TOL)
|
||||
assert isotope[1] == approx(NATURAL_ABUNDANCE[isotope[0]] * 100.0)
|
||||
|
||||
# Verify the expansion into WEIGHT fraction against natural composition
|
||||
natural = {'Li6': NATURAL_ABUNDANCE['Li6'] * atomic_mass('Li6'),
|
||||
|
|
@ -23,7 +20,7 @@ def test_expand_no_enrichment():
|
|||
natural[key] /= li_am
|
||||
|
||||
for isotope in lithium.expand(100.0, 'wo'):
|
||||
assert isotope[1] == approx(natural[isotope[0]] * 100.0, rel=TOL)
|
||||
assert isotope[1] == approx(natural[isotope[0]] * 100.0)
|
||||
|
||||
|
||||
def test_expand_enrichment():
|
||||
|
|
@ -33,11 +30,11 @@ def test_expand_enrichment():
|
|||
# Verify the enrichment by atoms
|
||||
ref = {'Li6': 75.0, 'Li7': 25.0}
|
||||
for isotope in lithium.expand(100.0, 'ao', 25.0, 'Li7', 'ao'):
|
||||
assert isotope[1] == approx(ref[isotope[0]], rel=TOL)
|
||||
assert isotope[1] == approx(ref[isotope[0]])
|
||||
|
||||
# Verify the enrichment by weight
|
||||
for isotope in lithium.expand(100.0, 'wo', 25.0, 'Li7', 'wo'):
|
||||
assert isotope[1] == approx(ref[isotope[0]], rel=TOL)
|
||||
assert isotope[1] == approx(ref[isotope[0]])
|
||||
|
||||
|
||||
def test_expand_exceptions():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue