mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 22:26:08 -04:00
Support time in h, min from ResultsList.get_atoms
This commit is contained in:
parent
a2691a32d5
commit
2394468a49
2 changed files with 12 additions and 4 deletions
|
|
@ -59,9 +59,9 @@ class ResultsList(list):
|
|||
Nuclide name to evaluate
|
||||
nuc_units : {"atoms", "atom/b-cm", "atom/cm3"}, optional
|
||||
Units for the returned concentration. Default is ``"atoms"``
|
||||
time_units : {"s", "d"}, optional
|
||||
time_units : {"s", "min", "h", "d"}, optional
|
||||
Units for the returned time array. Default is ``"s"`` to
|
||||
return the value in seconds
|
||||
return the value in seconds.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -71,7 +71,7 @@ class ResultsList(list):
|
|||
Concentration of specified nuclide in units of ``nuc_units``
|
||||
|
||||
"""
|
||||
check_value("time_units", time_units, {"s", "d"})
|
||||
check_value("time_units", time_units, {"s", "d", "min", "h"})
|
||||
check_value("nuc_units", nuc_units,
|
||||
{"atoms", "atom/b-cm", "atom/cm3"})
|
||||
|
||||
|
|
@ -86,6 +86,10 @@ class ResultsList(list):
|
|||
# Unit conversions
|
||||
if time_units == "d":
|
||||
time /= (60 * 60 * 24)
|
||||
elif time_units == "h":
|
||||
time /= (60 * 60)
|
||||
elif time_units == "min":
|
||||
time /= 60
|
||||
|
||||
if nuc_units != "atoms":
|
||||
# Divide by volume to get density
|
||||
|
|
|
|||
|
|
@ -34,8 +34,12 @@ def test_get_atoms(res):
|
|||
assert t_days == pytest.approx(t_ref / (60 * 60 * 24))
|
||||
assert n_cm3 == pytest.approx(n_ref / volume)
|
||||
|
||||
_t, n_bcm = res.get_atoms("1", "Xe135", nuc_units="atom/b-cm")
|
||||
t_min, n_bcm = res.get_atoms("1", "Xe135", nuc_units="atom/b-cm", time_units="min")
|
||||
assert n_bcm == pytest.approx(n_cm3 * 1e-24)
|
||||
assert t_min == pytest.approx(t_ref / 60)
|
||||
|
||||
t_hour, _n = res.get_atoms("1", "Xe135", time_units="h")
|
||||
assert t_hour == pytest.approx(t_ref / (60 * 60))
|
||||
|
||||
|
||||
def test_get_reaction_rate(res):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue