Skip to content

Add option to determine waste disposal rating by nuclide #3376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions openmc/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -1348,10 +1348,11 @@ def waste_classification(self, metal: bool = False) -> str:
return waste._waste_classification(self, metal=metal)

def waste_disposal_rating(
self,
limits: str | dict[str, float] = 'Fetter',
metal: bool = False,
) -> float:
self,
limits: str | dict[str, float] = 'Fetter',
metal: bool = False,
by_nuclide: bool = False,
) -> float | dict[str, float]:
"""Return the waste disposal rating for the material.

This method returns a waste disposal rating for the material based on a
Expand Down Expand Up @@ -1387,18 +1388,25 @@ def waste_disposal_rating(
metal : bool, optional
Whether or not the material is in metal form (only applicable for
NRC based limits)
by_nuclide : bool, optional
Whether to return the waste disposal rating for each nuclide in the
material. If True, a dictionary is returned where the keys are the
nuclide names and the values are the waste disposal ratings for each
nuclide. If False, a single float value is returned that represents
the overall waste disposal rating for the material.

Returns
-------
float
The waste disposal rating for the material.
float or dict
The waste disposal rating for the material or its constituent
nuclides.

See also
--------
Material.waste_classification()

"""
return waste._waste_disposal_rating(self, limits, metal)
return waste._waste_disposal_rating(self, limits, metal, by_nuclide)

def clone(self, memo: dict | None = None) -> Material:
"""Create a copy of this material with a new unique ID.
Expand Down
25 changes: 16 additions & 9 deletions openmc/waste.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ def classify_table2(col1, col2, col3):


def _waste_disposal_rating(
mat: openmc.Material,
limits: str | dict[str, float] = 'Fetter',
metal: bool = False,
) -> float:
mat: openmc.Material,
limits: str | dict[str, float] = 'Fetter',
metal: bool = False,
by_nuclide: bool = False,
) -> float | dict[str, float]:
"""Return the waste disposal rating for a material.

This method returns a waste disposal rating for the material based on a set
Expand Down Expand Up @@ -111,11 +112,17 @@ def _waste_disposal_rating(
metal : bool, optional
Whether or not the material is in metal form (only applicable for NRC
based limits)
by_nuclide : bool, optional
Whether to return the waste disposal rating for each nuclide in the
material. If True, a dictionary is returned where the keys are the
nuclide names and the values are the waste disposal ratings for each
nuclide. If False, a single float value is returned that represents the
overall waste disposal rating for the material.

Returns
-------
float
The waste disposal rating for the material.
float or dict
The waste disposal rating for the material or its constituent nuclides.

"""
if limits == 'Fetter':
Expand Down Expand Up @@ -272,8 +279,8 @@ def _waste_disposal_rating(

# Calculate the sum of the fractions of the activity of each radionuclide
# compared to the specified limits
ratio = 0.0
ratio = {}
for nuc, ci_m3 in mat.get_activity(units="Ci/m3", by_nuclide=True).items():
if nuc in limits:
ratio += ci_m3 / limits[nuc]
return ratio
ratio[nuc] = ci_m3 / limits[nuc]
return ratio if by_nuclide else sum(ratio.values())
4 changes: 4 additions & 0 deletions tests/unit_tests/test_waste_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,7 @@ def test_waste_disposal_rating():
ci_m3 = mat.get_activity('Ci/m3')
assert mat.waste_disposal_rating(limits={'K40': 2*ci_m3}) < 1.0
assert mat.waste_disposal_rating(limits={'K40': 0.5*ci_m3}) > 1.0

wdr = mat.waste_disposal_rating(limits={'K40': 4*ci_m3}, by_nuclide=True)
assert isinstance(wdr, dict)
assert wdr['K40'] == pytest.approx(1/4)