Suggestions from PR review by @Paulromano

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Jonathan Shimwell 2022-03-07 20:15:03 +00:00 committed by GitHub
parent d6063d253b
commit 4ba635f472
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 18 deletions

View file

@ -14,7 +14,6 @@ import numpy as np
from uncertainties import ufloat
import pytest
from openmc import Material
from openmc.mpi import comm
from openmc.deplete import (
ReactionRates, Results, ResultsList, OperatorResult, PredictorIntegrator,
@ -180,11 +179,8 @@ def test_integrator(run_in_tmpdir, scheme):
res = ResultsList.from_hdf5(
operator.output_dir / "depletion_results.h5")
mat = Material()
mat.id = 1
t1, y1 = res.get_atoms(mat, "1")
t2, y2 = res.get_atoms(mat, "2")
t1, y1 = res.get_atoms("1", "1")
t2, y2 = res.get_atoms("1", "2")
assert (t1 == [0.0, 0.75, 1.5]).all()
assert y1 == pytest.approx(bundle.atoms_1)

View file

@ -87,11 +87,8 @@ def test_restart(run_in_tmpdir, scheme):
results = openmc.deplete.ResultsList.from_hdf5(
operator.output_dir / "depletion_results.h5")
mat = openmc.Material()
mat.id = 1
_t, y1 = results.get_atoms(mat, "1")
_t, y2 = results.get_atoms(mat, "2")
_t, y1 = results.get_atoms("1", "1")
_t, y2 = results.get_atoms("1", "2")
assert y1 == pytest.approx(bundle.atoms_1)
assert y2 == pytest.approx(bundle.atoms_2)

View file

@ -21,7 +21,7 @@ def test_get_atoms(res):
mat = openmc.Material()
mat.id = 1
t, n = res.get_atoms(mat, "Xe135")
t, n = res.get_atoms("1", "Xe135")
t_ref = np.array([0.0, 1296000.0, 2592000.0, 3888000.0])
n_ref = np.array(
@ -33,24 +33,22 @@ def test_get_atoms(res):
# Check alternate units
volume = res[0].volume["1"]
t_days, n_cm3 = res.get_atoms(mat, "Xe135", nuc_units="atom/cm3", time_units="d")
t_days, n_cm3 = res.get_atoms("1", "Xe135", nuc_units="atom/cm3", time_units="d")
assert t_days == pytest.approx(t_ref / (60 * 60 * 24))
assert n_cm3 == pytest.approx(n_ref / volume)
t_min, n_bcm = res.get_atoms(mat, "Xe135", nuc_units="atom/b-cm", time_units="min")
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(mat, "Xe135", time_units="h")
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):
"""Tests evaluating reaction rate."""
mat = openmc.Material()
mat.id = 1
t, r = res.get_reaction_rate(mat, "Xe135", "(n,gamma)")
t, r = res.get_reaction_rate("1", "Xe135", "(n,gamma)")
t_ref = [0.0, 1296000.0, 2592000.0, 3888000.0]
n_ref = [6.67473282e+08, 3.72442707e+14, 3.61129692e+14, 4.01920099e+14]