mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
Add (currently failing) test with URR (n,gamma) reaction rate check
This commit is contained in:
parent
11ae5e92e2
commit
e54785f1a7
1 changed files with 42 additions and 0 deletions
42
tests/unit_tests/test_urr_capture.py
Normal file
42
tests/unit_tests/test_urr_capture.py
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import openmc
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def th232_model():
|
||||
# URR boundaries for Th232
|
||||
e_min, e_max = 4000.0, 100000.0
|
||||
|
||||
model = openmc.model.Model()
|
||||
th232 = openmc.Material()
|
||||
th232.add_nuclide('Th232', 1.0)
|
||||
|
||||
surf = openmc.Sphere(r=100.0, boundary_type='reflective')
|
||||
cell = openmc.Cell(fill=th232, region=-surf)
|
||||
model.geometry = openmc.Geometry([cell])
|
||||
|
||||
model.settings.particles = 100
|
||||
model.settings.batches = 10
|
||||
model.settings.run_mode = 'fixed source'
|
||||
energies = openmc.stats.Uniform(e_min, e_max)
|
||||
model.settings.source = openmc.Source(energy=energies)
|
||||
|
||||
tally = openmc.Tally(name='rates')
|
||||
tally.filters = [openmc.EnergyFilter([e_min, e_max])]
|
||||
tally.scores = ['(n,gamma)', 'absorption', 'fission']
|
||||
model.tallies.append(tally)
|
||||
return model
|
||||
|
||||
|
||||
def test_urr_capture(run_in_tmpdir, th232_model):
|
||||
# Export and run model
|
||||
th232_model.export_to_xml()
|
||||
openmc.run()
|
||||
|
||||
# Get reaction rates from tally
|
||||
with openmc.StatePoint('statepoint.10.h5') as sp:
|
||||
t = sp.get_tally(name='rates')
|
||||
ngamma, absorption, fission = t.mean.flatten()
|
||||
|
||||
# In URR, the (n,gamma) rate should be equal to absorption - fission
|
||||
assert ngamma == pytest.approx(absorption - fission)
|
||||
Loading…
Add table
Add a link
Reference in a new issue