From 0f2863b488433a8492f27aa7cd9b78ace2d8faba Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 24 Jan 2020 10:42:55 -0500 Subject: [PATCH 1/2] Allow control over status messages in Chain.from_endf --- openmc/deplete/chain.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/openmc/deplete/chain.py b/openmc/deplete/chain.py index 662106a6965..608d45a4372 100644 --- a/openmc/deplete/chain.py +++ b/openmc/deplete/chain.py @@ -189,7 +189,7 @@ def __len__(self): return len(self.nuclides) @classmethod - def from_endf(cls, decay_files, fpy_files, neutron_files): + def from_endf(cls, decay_files, fpy_files, neutron_files, progress=True): """Create a depletion chain from ENDF files. Parameters @@ -200,12 +200,20 @@ def from_endf(cls, decay_files, fpy_files, neutron_files): List of ENDF neutron-induced fission product yield sub-library files neutron_files : list of str List of ENDF neutron reaction sub-library files + progress : bool, optional + Flag to print status messages during processing. Does not + effect warning messages + + Returns + ------- + Chain """ chain = cls() # Create dictionary mapping target to filename - print('Processing neutron sub-library files...') + if progress: + print('Processing neutron sub-library files...') reactions = {} for f in neutron_files: evaluation = openmc.data.endf.Evaluation(f) @@ -219,7 +227,8 @@ def from_endf(cls, decay_files, fpy_files, neutron_files): reactions[name][mt] = q_value # Determine what decay and FPY nuclides are available - print('Processing decay sub-library files...') + if progress: + print('Processing decay sub-library files...') decay_data = {} for f in decay_files: data = openmc.data.Decay(f) @@ -228,13 +237,15 @@ def from_endf(cls, decay_files, fpy_files, neutron_files): continue decay_data[data.nuclide['name']] = data - print('Processing fission product yield sub-library files...') + if progress: + print('Processing fission product yield sub-library files...') fpy_data = {} for f in fpy_files: data = openmc.data.FissionProductYields(f) fpy_data[data.nuclide['name']] = data - print('Creating depletion_chain...') + if progress: + print('Creating depletion_chain...') missing_daughter = [] missing_rx_product = [] missing_fpy = [] From 2ef7ec2df52e529531f7fb27712f92ff62444e5b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 28 Jan 2020 13:33:45 -0500 Subject: [PATCH 2/2] Update Chain.from_endf docstring: Support Evaluations --- openmc/deplete/chain.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/openmc/deplete/chain.py b/openmc/deplete/chain.py index 608d45a4372..814de12fc47 100644 --- a/openmc/deplete/chain.py +++ b/openmc/deplete/chain.py @@ -192,13 +192,18 @@ def __len__(self): def from_endf(cls, decay_files, fpy_files, neutron_files, progress=True): """Create a depletion chain from ENDF files. + String arguments in ``decay_files``, ``fpy_files``, and + ``neutron_files`` will be treated as file names to be read. + Alternatively, :class:`openmc.data.endf.Evaluation` instances + can be included in these arguments. + Parameters ---------- - decay_files : list of str + decay_files : list of str or openmc.data.endf.Evaluation List of ENDF decay sub-library files - fpy_files : list of str + fpy_files : list of str or openmc.data.endf.Evaluation List of ENDF neutron-induced fission product yield sub-library files - neutron_files : list of str + neutron_files : list of str or openmc.data.endf.Evaluation List of ENDF neutron reaction sub-library files progress : bool, optional Flag to print status messages during processing. Does not