From dc3ab07cedf867dc2c870d2ddb547221c83d713f Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Fri, 13 Sep 2019 10:59:18 -0500 Subject: [PATCH] Make sure no heating adjustments are made if HEATR is not run --- openmc/data/neutron.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/openmc/data/neutron.py b/openmc/data/neutron.py index c63142d141..022cf8283d 100644 --- a/openmc/data/neutron.py +++ b/openmc/data/neutron.py @@ -813,6 +813,15 @@ class IncidentNeutron(EqualityMixin): for table in lib.tables[1:]: data.add_temperature_from_ace(table) + # Add 0K elastic scattering cross section + if '0K' not in data.energy: + pendf = Evaluation(kwargs['pendf']) + file_obj = StringIO(pendf.section[3, 2]) + get_head_record(file_obj) + params, xs = get_tab1_record(file_obj) + data.energy['0K'] = xs.x + data[2].xs['0K'] = xs + # Add fission energy release data ev = evaluation if evaluation is not None else Evaluation(filename) if (1, 458) in ev.section: @@ -833,8 +842,9 @@ class IncidentNeutron(EqualityMixin): # The best way to handle this is to subtract off the fission # KERMA that NJOY calculates and add back exactly what we want. - heating_local = Reaction(901) - heating_local.redundant = True + # If NJOY is not run with HEATR at all, skip everything below + if not kwargs["heatr"]: + return data # Helper function to get a cross section from an ENDF file on a # given energy grid @@ -844,6 +854,9 @@ class IncidentNeutron(EqualityMixin): _, xs = get_tab1_record(file_obj) return xs(E) + heating_local = Reaction(901) + heating_local.redundant = True + heatr_evals = get_evaluations(kwargs["heatr"]) heatr_local_evals = get_evaluations(kwargs["heatr"] + "_local") for ev, ev_local in zip(heatr_evals, heatr_local_evals): @@ -877,15 +890,6 @@ class IncidentNeutron(EqualityMixin): data.reactions[901] = heating_local - # Add 0K elastic scattering cross section - if '0K' not in data.energy: - pendf = Evaluation(kwargs['pendf']) - file_obj = StringIO(pendf.section[3, 2]) - get_head_record(file_obj) - params, xs = get_tab1_record(file_obj) - data.energy['0K'] = xs.x - data[2].xs['0K'] = xs - return data def _get_redundant_reaction(self, mt, mts):