mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
Make sure FluxCollapseHelper loads missing nuclide data (#2694)
This commit is contained in:
parent
7b0eb9d402
commit
98fe64dd5a
2 changed files with 33 additions and 1 deletions
|
|
@ -268,6 +268,11 @@ class FluxCollapseHelper(ReactionRateHelper):
|
|||
if self._reactions_direct and self._nuclides_direct is None:
|
||||
self._rate_tally.nuclides = nuclides
|
||||
|
||||
# Make sure nuclide data is loaded
|
||||
for nuclide in self.nuclides:
|
||||
if nuclide not in openmc.lib.nuclides:
|
||||
openmc.lib.load_nuclide(nuclide)
|
||||
|
||||
def generate_tallies(self, materials, scores):
|
||||
"""Produce multigroup flux spectrum tally
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import pytest
|
|||
@pytest.fixture
|
||||
def model():
|
||||
"""Sphere of single nuclide"""
|
||||
model = openmc.model.Model()
|
||||
model = openmc.Model()
|
||||
|
||||
w = openmc.Material(name='tungsten')
|
||||
w.add_nuclide('W186', 1.0)
|
||||
|
|
@ -161,3 +161,30 @@ def test_decay(run_in_tmpdir):
|
|||
# Ensure density goes down by a factor of 2 after each half-life
|
||||
assert atoms[1] / atoms[0] == pytest.approx(0.5)
|
||||
assert atoms[2] / atoms[1] == pytest.approx(0.25)
|
||||
|
||||
|
||||
def test_flux_rr_missing_nuclide(run_in_tmpdir, model):
|
||||
# Create two-nuclide depletion chain -- since W184 is not in the model, this
|
||||
# test ensures that FluxCollapseHelper loads missing nuclides appropriately
|
||||
chain = openmc.deplete.Chain()
|
||||
w184 = openmc.deplete.Nuclide('W184')
|
||||
w184.add_reaction('(n,gamma)', None, 0.0, 1.0)
|
||||
chain.add_nuclide(w184)
|
||||
w186 = openmc.deplete.Nuclide('W186')
|
||||
w186.add_reaction('(n,gamma)', None, 0.0, 1.0)
|
||||
chain.add_nuclide(w186)
|
||||
chain.export_to_xml('test_chain.xml')
|
||||
|
||||
# Create transport operator
|
||||
op = openmc.deplete.CoupledOperator(
|
||||
model, 'test_chain.xml',
|
||||
normalization_mode="source-rate",
|
||||
reaction_rate_mode="flux",
|
||||
reaction_rate_opts={'energies': [0.0, 20.0e6]},
|
||||
)
|
||||
|
||||
# Deplete with two decay steps
|
||||
integrator = openmc.deplete.PredictorIntegrator(
|
||||
op, [100.0], source_rates=[10.0]
|
||||
)
|
||||
integrator.integrate()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue