Skip to content

Commit

Permalink
fix unit conversion in openmc.deplete.Results.get_mass (#2761)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Linden <n.linden@naarea.fr>
  • Loading branch information
nplinden and Nicolas Linden committed Nov 9, 2023
1 parent 7c14603 commit 910d1df
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion openmc/deplete/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def get_mass(self,
# Divide by volume to get density
mass /= self[0].volume[mat_id]
elif mass_units == "kg":
mass *= 1e3
mass /= 1e3

return times, mass

Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_deplete_resultslist.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_get_mass(res):
assert n_cm3 == pytest.approx(n_ref / volume)

t_min, n_bcm = res.get_mass("1", "Xe135", mass_units="kg", time_units="min")
assert n_bcm == pytest.approx(n_ref * 1e3)
assert n_bcm == pytest.approx(n_ref / 1e3)
assert t_min == pytest.approx(t_ref / 60)

t_hour, _n = res.get_mass("1", "Xe135", time_units="h")
Expand Down

0 comments on commit 910d1df

Please sign in to comment.