From 7156d7cd986106973e57366c9c6815b73344085c Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Sat, 8 Apr 2017 15:48:20 -0500 Subject: [PATCH] Respond to @nelsonag comments on #852 --- docs/source/devguide/workflow.rst | 17 ++++++++++------ docs/source/usersguide/cross_sections.rst | 24 +++++++++++++++++++++++ openmc/examples.py | 21 +++++++++++++++++--- openmc/model/model.py | 10 ++++++---- 4 files changed, 59 insertions(+), 13 deletions(-) diff --git a/docs/source/devguide/workflow.rst b/docs/source/devguide/workflow.rst index 7a303f45e9..942cee55be 100644 --- a/docs/source/devguide/workflow.rst +++ b/docs/source/devguide/workflow.rst @@ -105,15 +105,20 @@ in the tests directory. We recommend to developers to test their branches before submitting a formal pull request using gfortran and Intel compilers if available. -The test suite is designed to integrate with cmake using ctest_. -It is configured to run with cross sections from NNDC_. To -download these cross sections please do the following: +The test suite is designed to integrate with cmake using ctest_. It is +configured to run with cross sections from NNDC_ augmented with 0 K elastic +scattering data for select nuclides as well as multipole data. To download the +proper data, run the following commands: .. code-block:: sh - cd ../scripts - ./openmc-get-nndc-data - export OPENMC_CROSS_SECTIONS=/nndc_hdf5/cross_sections.xml + wget -O nndc_hdf5.tar.xz $(cat /.travis.yml | grep anl.box | awk '{print $2}') + tar xJvf nndc_hdf5.tar.xz + export OPENMC_CROSS_SECTIONS=$(pwd)/nndc_hdf5/cross_sections.xml + + git clone --branch=master git://github.com/smharper/windowed_multipole_library.git wmp_lib + tar xzvf wmp_lib/multipole_lib.tar.gz + export OPENMC_MULTIPOLE_LIBRARY=$(pwd)/multipole_lib The test suite can be run on an already existing build using: diff --git a/docs/source/usersguide/cross_sections.rst b/docs/source/usersguide/cross_sections.rst index 25bb1e5d83..fa61045c6c 100644 --- a/docs/source/usersguide/cross_sections.rst +++ b/docs/source/usersguide/cross_sections.rst @@ -199,6 +199,30 @@ OpenMC. etc. For a more thorough overview of the capabilities of this class, see the :ref:`notebook_nuclear_data` example notebook. +Enabling Resonance Scattering Treatments +---------------------------------------- + +In order for OpenMC to correctly treat elastic scattering in heavy nuclides +where low-lying resonances might be present (see +:ref:`energy_dependent_xs_model`), the elastic scattering cross section at 0 K +must be present. To add the 0 K elastic scattering cross section to existing +:class:`IncidentNeutron` instance, you can use the +:meth:`IncidentNeutron.add_elastic_0K_from_endf` method which requires an ENDF +file for the nuclide you are modifying:: + + u238 = openmc.data.IncidentNeutron.from_hdf5('U238.h5') + u238.add_elastic_0K_from_endf('n-092_U_238.endf') + u238.export_to_hdf5('U238_with_0K.h5') + +With 0 K elastic scattering data present, you can turn on a resonance scattering +method using :attr:`Settings.resonance_scattering`. + +.. note:: The process of reconstructing resonances and generating tabulated 0 K + cross sections can be computationally expensive, especially for + nuclides like U-238 where thousands of resonances are present. Thus, + running the :meth:`IncidentNeutron.add_elastic_0K_from_endf` method + may take several minutes to complete. + ----------------------- Windowed Multipole Data ----------------------- diff --git a/openmc/examples.py b/openmc/examples.py index 6e2a04f7f6..0e17747fc3 100644 --- a/openmc/examples.py +++ b/openmc/examples.py @@ -7,6 +7,11 @@ import openmc.model def pwr_pin_cell(): """Create a PWR pin-cell model. + This model is a single fuel pin with 2.4 w/o enriched UO2 corresponding to a + beginning-of-cycle condition and borated water. The specifications are from + the `BEAVRS `_ benchmark. Note that the + number of particles/batches is initially set very low for testing purposes. + Returns ------- model : openmc.model.Model @@ -85,7 +90,8 @@ def pwr_core(): This model is the OECD/NEA Monte Carlo Performance benchmark which is a grossly simplified pressurized water reactor (PWR) with 241 fuel - assemblies. + assemblies. Note that the number of particles/batches is initially set very + low for testing purposes. Returns ------- @@ -428,6 +434,11 @@ def pwr_core(): def pwr_assembly(): """Create a PWR assembly model. + This model is a reflected 17x17 fuel assembly from the the `BEAVRS + `_ benchmark. The fuel is 2.4 w/o + enriched UO2 corresponding to a beginning-of-cycle condition. Note that the + number of particles/batches is initially set very low for testing purposes. + Returns ------- model : openmc.model.Model @@ -538,8 +549,12 @@ def slab_mg(reps=None, as_macro=True): Parameters ---------- reps : list, optional - List of angular representations. Items can be 'ang', 'ang_mu', 'iso', or - 'iso_mu'. + List of angular representations. Each item corresponds to materials and + dictates the angular representation of the multi-group cross + sections---isotropic ('iso') or angle-dependent ('ang'), and if Legendre + scattering or tabular scattering ('mu') is used. Thus, items can be + 'ang', 'ang_mu', 'iso', or 'iso_mu'. + as_macro : bool, optional Whether :class:`openmc.Macroscopic` is used diff --git a/openmc/model/model.py b/openmc/model/model.py index ec8ec54064..17de6fc2e6 100644 --- a/openmc/model/model.py +++ b/openmc/model/model.py @@ -10,7 +10,10 @@ class Model(object): This class can be used to store instances of :class:`openmc.Geometry`, :class:`openmc.Materials`, :class:`openmc.Settings`, :class:`openmc.Tallies`, :class:`openmc.Plots`, and :class:`openmc.CMFD`, - thus making a complete model. + thus making a complete model. The :meth:`Model.export_to_xml` method will + export XML files for all attributes that have been set. If the + :meth:`Model.materials` attribute is not set, it will attempt to create a + ``materials.xml`` file based on all materials appearing in the geometry. Parameters ---------- @@ -50,9 +53,8 @@ class Model(object): self.materials = openmc.Materials() self.settings = openmc.Settings() self.cmfd = cmfd - - self._tallies = openmc.Tallies() - self._plots = openmc.Plots() + self.tallies = openmc.Tallies() + self.plots = openmc.Plots() if geometry is not None: self.geometry = geometry