From ebe345cd3df0f3dbb4fe7d8451399a415ff58317 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Mon, 20 Jul 2026 09:05:03 -0500 Subject: [PATCH] Change name to displacement_energy, remove test --- openmc/data/njoy.py | 18 +++++++----------- tests/unit_tests/test_data_neutron.py | 8 -------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/openmc/data/njoy.py b/openmc/data/njoy.py index 3d0fcc110..7c99637f0 100644 --- a/openmc/data/njoy.py +++ b/openmc/data/njoy.py @@ -259,14 +259,14 @@ broadr / %%%%%%%%%%%%%%%%%%%%%%% Doppler broaden XS %%%%%%%%%%%%%%%%%%%%%%%%%%%% _TEMPLATE_HEATR = """ heatr / %%%%%%%%%%%%%%%%%%%%%%%%% Add heating kerma %%%%%%%%%%%%%%%%%%%%%%%%%%%% {nendf} {nheatr_in} {nheatr} / -{mat} 4 0 0 0 0 {damage_threshold}/ +{mat} 4 0 0 0 0 {ed}/ 302 318 402 444 / """ _TEMPLATE_HEATR_LOCAL = """ heatr / %%%%%%%%%%%%%%%%% Add heating kerma (local photons) %%%%%%%%%%%%%%%%%%%% {nendf} {nheatr_in} {nheatr_local} / -{mat} 4 0 0 1 0 {damage_threshold}/ +{mat} 4 0 0 1 0 {ed}/ 302 318 402 444 / """ @@ -411,7 +411,7 @@ def make_pendf(filename, pendf='pendf', **kwargs): def make_ace(filename, temperatures=None, acer=True, xsdir=None, output_dir=None, pendf=False, error=0.001, broadr=True, heatr=True, gaspr=True, purr=True, evaluation=None, - smoothing=True, damage_threshold=None, **kwargs): + smoothing=True, displacement_energy=None, **kwargs): """Generate incident neutron ACE file from an ENDF file File names can be passed to @@ -463,8 +463,9 @@ def make_ace(filename, temperatures=None, acer=True, xsdir=None, indicates which evaluation should be used. smoothing : bool, optional If the smoothing option (ACER card 6) is on (True) or off (False). - damage_threshold : float, optional - Displacement damage threshold in eV. Used in heatr to calculate damage-energy cross section. When None use NJOY defaults. + displacement_energy : float, optional + Threshold displacement energy in [eV]. Used in HEATR to calculate + damage-energy cross section. When None, use NJOY defaults. **kwargs Keyword arguments passed to :func:`openmc.data.njoy.run` @@ -517,12 +518,7 @@ def make_ace(filename, temperatures=None, acer=True, xsdir=None, # heatr if heatr: - # prevent using NJOY default by setting to a small number - if damage_threshold == 0.0: - damage_threshold = 1e-5 - # the NJOY default is 0 - if damage_threshold is None: - damage_threshold = 0.0 + ed = displacement_energy if displacement_energy is not None else 0 nheatr_in = nlast nheatr_local = nheatr_in + 1 tapeout[nheatr_local] = (output_dir / "heatr_local") if heatr is True \ diff --git a/tests/unit_tests/test_data_neutron.py b/tests/unit_tests/test_data_neutron.py index 115541a06..c767f0171 100644 --- a/tests/unit_tests/test_data_neutron.py +++ b/tests/unit_tests/test_data_neutron.py @@ -244,14 +244,6 @@ def test_kerma(run_in_tmpdir, am244, h2): assert 901 in read_in assert np.all(read_in[901].xs['300K'].y == h2[901].xs['300K'].y) -@needs_njoy -def test_damage_energy(tmpdir, endf_data): - endf_file = os.path.join(endf_data, 'neutrons', 'n-014_Si_030.endf') - si30 = openmc.data.IncidentNeutron.from_njoy(endf_file) - - si30_copy = openmc.data.IncidentNeutron.from_njoy(endf_file, damage_threshold=100) - assert not np.allclose(si30[444].xs['294K'].y, si30_copy[444].xs['294K'](si30[444].xs['294K'].x)) - def test_urr(pu239): for T, ptable in pu239.urr.items():