From 7badc48c225671a087fa78300bfd3dbcd16f2906 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 3 Sep 2019 16:15:14 -0500 Subject: [PATCH] Instruct njoy interface to retain heatr output HEATR contains the 318 fission heating data needed to construct the energy deposition tally. Until now, the output tape was left in the njoy temporary directory with the other output tapes. This commit instructs openmc.data.njoy to move the heatr output from the running directory used in njoy.run to the working directory used in njoy.make_ace Removed unused imports argparse and sys --- openmc/data/neutron.py | 5 ++--- openmc/data/njoy.py | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/openmc/data/neutron.py b/openmc/data/neutron.py index a53194aa7..22c9d0305 100644 --- a/openmc/data/neutron.py +++ b/openmc/data/neutron.py @@ -813,9 +813,8 @@ class IncidentNeutron(EqualityMixin): """ with tempfile.TemporaryDirectory() as tmpdir: # Run NJOY to create an ACE library - kwargs.setdefault('ace', os.path.join(tmpdir, 'ace')) - kwargs.setdefault('xsdir', os.path.join(tmpdir, 'xsdir')) - kwargs.setdefault('pendf', os.path.join(tmpdir, 'pendf')) + for key in ["ace", "xsdir", "pendf", "heatr"]: + kwargs.setdefault(key, os.path.join(tmpdir, key)) kwargs['evaluation'] = evaluation make_ace(filename, temperatures, **kwargs) diff --git a/openmc/data/njoy.py b/openmc/data/njoy.py index c8d630851..3fb75751f 100644 --- a/openmc/data/njoy.py +++ b/openmc/data/njoy.py @@ -1,10 +1,8 @@ -import argparse from collections import namedtuple from io import StringIO import os import shutil from subprocess import Popen, PIPE, STDOUT, CalledProcessError -import sys import tempfile from . import endf @@ -237,8 +235,9 @@ def make_ace(filename, temperatures=None, ace='ace', xsdir='xsdir', pendf=None, Fractional error tolerance for NJOY processing broadr : bool, optional Indicating whether to Doppler broaden XS when running NJOY - heatr : bool, optional - Indicating whether to add heating kerma when running NJOY + heatr : bool or str, optional + Indicating whether to add heating kerma when running NJOY. If string, + write the output tape to this file gaspr : bool, optional Indicating whether to add gas production data when running NJOY purr : bool, optional @@ -292,6 +291,7 @@ def make_ace(filename, temperatures=None, ace='ace', xsdir='xsdir', pendf=None, if heatr: nheatr_in = nlast nheatr = nheatr_in + 1 + tapeout[nheatr] = "heatr" if heatr is True else heatr commands += _TEMPLATE_HEATR nlast = nheatr