From 7988bad6dacdf29b04210f8f16edc7a29fb2d684 Mon Sep 17 00:00:00 2001 From: liangjg Date: Fri, 28 Jul 2017 11:56:32 -0400 Subject: [PATCH] made error tolerance a parameter for generating data from njoy --- openmc/data/neutron.py | 6 ++++-- openmc/data/njoy.py | 24 +++++++++++++++--------- openmc/data/thermal.py | 7 +++++-- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/openmc/data/neutron.py b/openmc/data/neutron.py index ed2f4f8b7..8accabfc7 100644 --- a/openmc/data/neutron.py +++ b/openmc/data/neutron.py @@ -824,7 +824,7 @@ class IncidentNeutron(EqualityMixin): return data @classmethod - def from_njoy(cls, filename, temperatures=None, **kwargs): + def from_njoy(cls, filename, temperatures=None, error=0.001, **kwargs): """Generate incident neutron data by running NJOY. Parameters @@ -834,6 +834,8 @@ class IncidentNeutron(EqualityMixin): temperatures : iterable of float Temperatures in Kelvin to produce data at. If omitted, data is produced at room temperature (293.6 K) + error : float, optional + Fractional error tolerance for NJOY processing. **kwargs Keyword arguments passed to :func:`openmc.data.njoy.make_ace` @@ -851,7 +853,7 @@ class IncidentNeutron(EqualityMixin): ace_file = os.path.join(tmpdir, 'ace') xsdir_file = os.path.join(tmpdir, 'xsdir') pendf_file = os.path.join(tmpdir, 'pendf') - make_ace(filename, temperatures, ace_file, xsdir_file, + make_ace(filename, temperatures, error, ace_file, xsdir_file, pendf_file, **kwargs) # Create instance from ACE tables within library diff --git a/openmc/data/njoy.py b/openmc/data/njoy.py index b6fce5e3e..5365d9740 100644 --- a/openmc/data/njoy.py +++ b/openmc/data/njoy.py @@ -68,14 +68,14 @@ reconr / %%%%%%%%%%%%%%%%%%% Reconstruct XS for neutrons %%%%%%%%%%%%%%%%%%%%%%% 20 21 '{library} PENDF for {zsymam}'/ {mat} 2/ -0.001 0.0 0.003/ err tempr errmax +{error}/ err '{library}: {zsymam}'/ 'Processed by NJOY'/ 0/ broadr / %%%%%%%%%%%%%%%%%%%%%%% Doppler broaden XS %%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 21 22 {mat} {num_temp} 0 0 0. / -0.001 1.0e6 0.003 / +{error}/ errthn {temps} 0/ heatr / %%%%%%%%%%%%%%%%%%%%%%%%% Add heating kerma %%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -104,26 +104,26 @@ reconr / %%%%%%%%%%%%%%%%%%% Reconstruct XS for neutrons %%%%%%%%%%%%%%%%%%%%%%% 20 22 '{library} PENDF for {zsymam}'/ {mat} 2/ -0.001 0. 0.001/ err tempr errmax +{error}/ err '{library}: PENDF for {zsymam}'/ 'Processed by NJOY'/ 0/ broadr / %%%%%%%%%%%%%%%%%%%%%%% Doppler broaden XS %%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 22 23 {mat} {num_temp} 0 0 0./ -0.001 2.0e+6 0.001/ errthn thnmax errmax +{error}/ errthn {temps} 0/ thermr / %%%%%%%%%%%%%%%% Add thermal scattering data (free gas) %%%%%%%%%%%%%%% 0 23 62 0 {mat} 12 {num_temp} 1 0 {iform} 1 221 1/ {temps} -0.001 {energy_max} +{error} {energy_max} thermr / %%%%%%%%%%%%%%%% Add thermal scattering data (bound) %%%%%%%%%%%%%%%%%% 60 62 27 {mat_thermal} {mat} 16 {num_temp} {inelastic} {elastic} {iform} {natom} 222 1/ {temps} -0.001 {energy_max} +{error} {energy_max} """ _ACE_THERMAL_TEMPLATE_ACER = """acer / @@ -195,7 +195,7 @@ def run(commands, tapein, tapeout, stdout=False, njoy_exec='njoy'): return njoy.returncode -def make_pendf(filename, pendf='pendf', stdout=False): +def make_pendf(filename, pendf='pendf', error=0.001, stdout=False): """Generate ACE file from an ENDF file Parameters @@ -204,6 +204,8 @@ def make_pendf(filename, pendf='pendf', stdout=False): Path to ENDF file pendf : str, optional Path of pointwise ENDF file to write + error : float, optional + Fractional error tolerance for NJOY processing. stdout : bool Whether to display NJOY standard output @@ -226,7 +228,7 @@ def make_pendf(filename, pendf='pendf', stdout=False): return run(commands, tapein, tapeout, stdout) -def make_ace(filename, temperatures=None, ace='ace', xsdir='xsdir', +def make_ace(filename, temperatures=None, error=0.001, ace='ace', xsdir='xsdir', pendf=None, **kwargs): """Generate incident neutron ACE file from an ENDF file @@ -237,6 +239,8 @@ def make_ace(filename, temperatures=None, ace='ace', xsdir='xsdir', temperatures : iterable of float, optional Temperatures in Kelvin to produce ACE files at. If omitted, data is produced at room temperature (293.6 K). + error : float, optional + Fractional error tolerance for NJOY processing. ace : str, optional Path of ACE file to write xsdir : str, optional @@ -311,7 +315,7 @@ def make_ace(filename, temperatures=None, ace='ace', xsdir='xsdir', return retcode -def make_ace_thermal(filename, filename_thermal, temperatures=None, +def make_ace_thermal(filename, filename_thermal, temperatures=None, error=0.001, ace='ace', xsdir='xsdir', **kwargs): """Generate thermal scattering ACE file from ENDF files @@ -324,6 +328,8 @@ def make_ace_thermal(filename, filename_thermal, temperatures=None, temperatures : iterable of float, optional Temperatures in Kelvin to produce data at. If omitted, data is produced at all temperatures given in the ENDF thermal scattering sublibrary. + error : float, optional + Fractional error tolerance for NJOY processing. ace : str, optional Path of ACE file to write xsdir : str, optional diff --git a/openmc/data/thermal.py b/openmc/data/thermal.py index 6e7b0fe02..1d63c1ade 100644 --- a/openmc/data/thermal.py +++ b/openmc/data/thermal.py @@ -588,7 +588,8 @@ class ThermalScattering(EqualityMixin): return table @classmethod - def from_njoy(cls, filename, filename_thermal, temperatures=None, **kwargs): + def from_njoy(cls, filename, filename_thermal, temperatures=None, + error=0.001, **kwargs): """Generate incident neutron data by running NJOY. Parameters @@ -601,6 +602,8 @@ class ThermalScattering(EqualityMixin): Temperatures in Kelvin to produce data at. If omitted, data is produced at all temperatures in the ENDF thermal scattering sublibrary. + error : float, optional + Fractional error tolerance for NJOY processing. **kwargs Keyword arguments passed to :func:`openmc.data.njoy.make_ace_thermal` @@ -617,7 +620,7 @@ class ThermalScattering(EqualityMixin): # Run NJOY to create an ACE library ace_file = os.path.join(tmpdir, 'ace') xsdir_file = os.path.join(tmpdir, 'xsdir') - make_ace_thermal(filename, filename_thermal, temperatures, + make_ace_thermal(filename, filename_thermal, temperatures, error, ace_file, xsdir_file, **kwargs) # Create instance from ACE tables within library