Use flux reaction_rate_mode in activation test

This commit is contained in:
Paul Romano 2020-08-04 16:11:11 -05:00
parent 76fc6fb3e7
commit fbcd789f20

View file

@ -1,6 +1,8 @@
from math import pi, log
from math import pi, log, log10
from random import uniform, normalvariate
import numpy as np
import openmc.deplete
import openmc
import pytest
@ -38,7 +40,8 @@ def model():
return model
def test_activation(run_in_tmpdir, model):
@pytest.mark.parametrize("reaction_rate_mode", ["direct", "flux"])
def test_activation(run_in_tmpdir, model, reaction_rate_mode):
# Determine (n.gamma) reaction rate using initial run
sp = model.run()
with openmc.StatePoint(sp) as sp:
@ -53,9 +56,12 @@ def test_activation(run_in_tmpdir, model):
chain.export_to_xml('test_chain.xml')
# Create transport operator
energies = np.logspace(log10(1e-5), log10(2e7), 100)
op = openmc.deplete.Operator(
model.geometry, model.settings, 'test_chain.xml',
normalization_mode="source-rate"
normalization_mode="source-rate",
reaction_rate_mode=reaction_rate_mode,
reaction_rate_energies=energies,
)
# To determine the source rate necessary to reduce W186 density in half, we
@ -98,7 +104,7 @@ def test_activation(run_in_tmpdir, model):
_, atoms = results.get_atoms(str(w.id), "W186")
assert atoms[0] == pytest.approx(n0)
assert atoms[1] / atoms[0] == pytest.approx(0.5, rel=1e-3)
assert atoms[1] / atoms[0] == pytest.approx(0.5, rel=0.01)
def test_decay(run_in_tmpdir):