Docsity

serpent 2.2.0 Tools Documentation, Test d'ammissione di Ingegneria Nucleare

Anteprima parziale del testo

Scarica serpent 2.2.0 Tools Documentation e più Test d'ammissione in PDF di Ingegneria Nucleare solo su Docsity!

The serpentTools developer team

Feb 20, 2020

ii

A suite of parsers designed to make interacting with SERPENT [serpent] output files simple and flawless. The SERPENT Monte Carlo code is developed by VTT Technical Research Centre of Finland, Ltd. More information, including distribution and licensing of SERPENT can be found at http://montecarlo.vtt.fi The Annals of Nuclear Energy article should be cited for all work using SERPENT.

Preferred citation for attribution Andrew Johnson, Dan Kotlyar, Gavin Ridley, Stefano Terlizzi, & Paul Romano. (2018, June 29). “serpent-tools: A collection of parsing tools and data containers to make interacting with SERPENT outputs easy, intuitive, and flawless.,”.

CONTENTS: 1

CHAPTER

ONE

PROJECT OVERVIEW

The serpentTools package contains a variety of parsing utilities, each designed to read a specific output from the SERPENT Monte Carlo code [serpent]. Many of the parsing utilities store the outputs in custom container objects, while other store or return a collection of arrays. This page gives an overview of what files are currently supported, including links to examples and relevant documentation. Unless otherwise noted, all the files listed below can be read using serpentTools.read(). For example:

>>> import serpentTools >>> res = serpentTools.read('my_resFile_res.m')

would return a ResultsReader Some file-types have an additional reader that is capable of reading multiple files and computing actual uncertainties. These samplers are detailed in Samplers and listed under the supported files. Many of the readers have examples present in the Examples section. Each example is present as a Jupyter notebook at Github: examples. These can be used as a launching point for tutorials or for your own analysis.

1.1 Main output File

  • File Description: Primary output file for transport calculation - [input]_res.m
  • SERPENT wiki: result wiki
  • Primary Reader: ResultsReader
  • Example - notebook: ResultsReader
  • Example - manual: Results Reader

1.2 Depletion File

  • File Description: Output from burnup calculations, showing quantities for various materials - [input]_dep. m
  • SERPENT wiki: depletion wiki
  • Primary Reader: DepletionReader
  • Example - notebook: DepletionReader
  • Example - manual: Depletion Reader
  • Sampler - serpentTools.samplers.DepletionSampler

3

1.3 Detector/ Tally File

  • File Description: Output generated by creating detectors - [input]_det[N].m
  • SERPENT wiki: detector definition
  • Primary Reader: DetectorReader
  • Example - notebook: Detector
  • Example - manual: Detector Reader
  • Sampler - serpentTools.samplers.DetectorSampler

1.4 Sensitivity File

  • File Description: Output giving sensitivities of defined responses to perturbations - [input]_sens[N].m
  • SERPENT wiki: sensitivity wiki
  • Primary Reader: SensitivityReader
  • Example - notebook: Sensitivity
  • Example - manual: Sensitivity Reader

1.5 Branching Coefficient File

  • File Description: Selected homogenized group constants across a variety of defined branch states - [input]. coe
  • SERPENT wiki: branching wiki
  • Primary Reader: BranchingReader
  • Secondary Read function: serpentTools.BranchCollector.fromFile()
  • Example - notebook: Branching
  • Example - manual: Branching Reader

1.6 Micro-depletion File

  • File Description:
  • SERPENT wiki: microxs wiki
  • Primary Reader: MicroXSReader
  • Example - notebook: MicroXSReader
  • Example - manual: Micro cross section reader

4 Chapter 1. Project Overview

6 Chapter 1. Project Overview

CHAPTER

TWO

INSTALLATION

In order to properly install this package, you need a version of python that plays well with libraries like numpy and matplotlib. This is easy or less easy depending on your operating system, but we have a brief walk through at Obtaining a Python Distribution.

2.1 Terminal terminology

Commands below that begin with $ must be run from the terminal containing your preferred python distribution, neglecting the $. Depending on operating system, this could be the normal terminal, or a modified prompt. See Obtaining a Python Distribution for more information if you are not sure. Commands that begin with >>> should be run inside of a python environment. The following would be a valid set of instructions to pass to your terminal, printing a very basic python command:

$ python -m "print('hello world')" hello world $ python >>> print('hello world') hello world

2.2 Installing from pip

pip is the easiest way to install the latest version of serpentTools. First, ensure that you have numpy installed, as this is one of the required packages that is tricky to install. You can check by opening up a your preferred terminal and executing

$ python -c "import numpy"

If this fails, please consult Obtaining a Python Distribution. Next, installation with pip can be completed with:

$ python -m pip install --user --upgrade pip serpentTools

This installs the dependencies of the package, the latest serpentTools release, and upgrades your version of pip along the way. When a new release is issued, run the command again to install the updated version. If you wish to install the development branch to get the latest updates as they happen, use the following command:

$ python -m pip install -e git+https://www.github.com/CORE-GATECH-GROUP/serpent-tools. ˓→git@develop#egg=serpentTools

2.5 Obtaining a Python Distribution

Obtaining a version of python into which serpent-tools can be installed varies by operating system, with Win- dows requiring the most finesse.

2.5.1 Linux/Mac/Unix-like Operating Systems

If you don’t have numpy installed, you will have to obtain it from your package manager or from pip:

ubuntu

$ sudo apt-get install python-numpy

pip

$ sudo pip install --upgrade numpy

If you already have numpy, then the pip installtion process will take care of our other dependencies.

2.5.2 Windows

The easiest and most painless way to obtain packages like numpy on Windows is with either the Anaconda or Mini- conda distributions. Each of these also includes the Anaconda Prompt which is a modified terminal that plays better with Python. The former comes with a few hundred packages, included most of the ones needed for this project, bundled for you. The latter is a very small distribution and requires you to install the packages you want via conda. Should you choose this route, then you need to launch the Anaconda Prompt and install with:

$ conda install setuptools numpy matplotlib pyyaml

This prompt is what you should use when following the instructions in in Installation.

2.5. Obtaining a Python Distribution 9

10 Chapter 2. Installation

3.4 0.8.

  • Use six>=1.13.
  • Use yaml>=5.1.

3.4.1 Bug Fixes

  • Fix detector.names setting

3.5 0.8.

Warning: Serpent 1 detectors are no longer supported - #327. Version 0.9.0 will remove support for python 2 -

  • Better handling of discontinuity factors - #
  • HomogUniv objects no longer automatically convert data to arrays
  • Serpent 2.1.31 is the default version for serpentVersion setting
  • Detectors and related subclasses are now standalone classes that can be imported as serpentTools. Detector - #
  • BranchContainer now inherits from dict - #
  • Keys for universes in ResultsReader.universes are UnivTuple
  • Keys for microscopic cross sections in MicroXSReader.xsVal and MicroXSReader.xsUnc are MicroXSTuple
  • Spread plots for sampled detector and depletion containers allow changing how the mean data and sampled data are plotted by passing dictionary of matplotlib commands, e.g. meanKwargs={"c": "r", "marker": x"} would plot the mean data in red with crosses as markers.

3.5.1 Bug Fixes

  • Burnup and days are properly set on homogenized universes when reading a result file with multiple universes but no burnup - #
  • Modifications made to detector tally data will be reflected in later plots - #337, #
  • Variable groups for version 2.1.31 are properly expanded - #

12 Chapter 3. Changelog

3.5.2 Incompatible API Changes

  • Values are stored in array form on HomogUniv when it makes sense. For example, values like infKinf are stored as scalars.
  • Setting expectGcu has been removed as #324 fixed how files without group constants are handled.
  • Keys to BranchedUniv objects stored in serpentTools.xs.BranchCollector.universes are stored as strings, rather than integers, e.g. 0 is replaced with "0" - #
  • Keys to HomogUniv instances stored on BranchContainer are now UnivTuple, or tuples with universe, burnup, step, days - #
  • serpentTools.Detector.indexes is now a tuple of strings describing each dimension of tallies rather than OrderedDict - #

3.6 0.7.

  • Add getitem() and setitem() convenience methods for accessing expected values on HomogUniv objects
  • Add thresh argument to Detector meshPlot where only data greater than thresh is plotted.
  • Mitigate pending deprecated imports from collections - #
  • Increase required version of yaml to 5.1.
  • Include SERPENT 2.1.31 support in serpentVersion setting

3.6.1 Bug fixes

  • Tally data for detectors with time-bins are properly handled - #
  • Support for generic string universe names for BranchingReader and BranchCollector - #

3.6.2 Pending Deprecations

  • Keys to BranchedUniv objects stored in serpentTools.xs.BranchCollector.universes are stored as strings, rather than integers, e.g. 0 is replaced with "0". A workaround is in-place, but will be removed in future versions.
  • SERPENT 1 style detectors with additional score column will not be supported starting at version 0.8.0.

3.7 0.7.

  • Easier construction of BranchCollector objects - #
    • Directly from the class fromFile
    • Don’t require passing branch information to BranchCollector. Will be inferred from file and set with (p0, p1, ...). State data can be used to determine which index is a given perturbation type.
  • Direct toMatlab methods for ResultsReader, SensitivityReader, DepmtxReader DepletionReader, DetectorReader, HistoryReader, and Detector objects - #290, #

3.8.1 Pending Deprecations

  • saveAsMatlab() in favor of serpentTools.io.toMatlab() with: >>> from serpentTools.io import toMatlab >>> toMatlab(depR)
  • Depletion plot routines will no longer accept timePoints arguments, instead plotting against all points in time

3.9 0.6.

  • #256 serpentTools.settings.rc.loadYaml() uses safe_load
  • #257 DepletionReader now can utilize saveAsMatlab() for exporting data to a binary .mat file
  • #259 Little more clarity into supported readers through documentation and serpentTools.read() func- tion

3.10 0.6.

  • #174 - Added parent object BaseObject with basic comparison method from which all objects inherit. Com- parison method contains upper and lower bounds for values w/o uncertainties, #
  • #196 - Add comparison methods for ResultsReader and HomogUniv objects
  • #228 - Add comparison methods for DetectorReader and Detector objects
  • #236 - Add comparison methods for DepletionReader and DepletedMaterial objects
  • #241 - Fix a bug in the CLI that rendered the ability to generate files with unique random seeds. python -m serpentTools seed can now be properly used.
  • #249 - Better sparse support for depletion matrix, depmtx files with a DepmtxReader
  • #252 - Better axis and colorbar labeling for Detector mesh plots
  • #254 - Better plotting of single concentrations with DepmtxReader
  • #255 - DepletionReader can capture material with underscores now!

3.10.1 Deprecations

  • depmtx() is deprecated in favor of either readDepmtx() or the class-based DepmtxReader

3.11 0.5.

  • #239 - Update python dependencies to continue use of python 2

3.12 0.5.

  • #221 - Expanded utils module to better assist developers
  • #227 - Better documentation of our Command Line Interface. Better documentation and testing of functions for generating input files with unique random seeds - serpentTools.seed
  • #229 - serpentTools.SensitivityReader.plot() now respects the option to not set x nor y labels.
  • #231 - ResultsReader objects can now read files that do not contain group constant data. The setting results-expectGcu should be used to inform the reader that no group constant data is anticipated

Note: This setting was removed in 0.8.0 and in #

3.13 0.5.

  • #198 - Import test and example files using serpentTools.data. Load example readers with serpentTools.data.readDataFile()
  • #199 - Support for structured or unstructured matrix plotting with serpentTools.plot. cartMeshPlot()
  • #201 - Support for plotting hexagonal meshes with serpentTools.objects.HexagonalDetector. hexPlot()
  • #204 - Access Detector objects directly from DetectorReader with reader[detName]
  • #205 - Access materials from DepletionReader and serpentTools.samplers. DepletionSampler using key-like indexing, e.g. reader[matName] == reader. material[matName]
  • #213 - Better default x-axis labels for simple Detector plots

3.13.1 API Changes

  • #194 - Some settings in serpentTools.ResultsReader.metadata are now stored as int or float, depending upon their nature. Many of these settings refer to flags of settings used by SERPENT

16 Chapter 3. Changelog