Merge branch 'develop' of github.com:openmc-dev/openmc into cmfd-omp

Conflicts:
	openmc/cmfd.py
This commit is contained in:
Shikhar Kumar 2019-11-04 22:52:16 -05:00
commit 362e4d16b4
181 changed files with 4426 additions and 2007 deletions

View file

@ -114,7 +114,11 @@ endif()
#===============================================================================
add_library(pugixml vendor/pugixml/pugixml.cpp)
target_include_directories(pugixml PUBLIC vendor/pugixml/)
target_include_directories(pugixml
PUBLIC
$<INSTALL_INTERFACE:include/pugixml>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/vendor/pugixml>
)
#===============================================================================
# xtensor header-only library
@ -134,7 +138,11 @@ target_link_libraries(xtensor INTERFACE xtl)
#===============================================================================
add_library(gsl INTERFACE)
target_include_directories(gsl INTERFACE vendor/gsl/include)
target_include_directories(gsl
INTERFACE
$<INSTALL_INTERFACE:include/gsl/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/vendor/gsl/include>
)
# Make sure contract violations throw exceptions
target_compile_definitions(gsl INTERFACE GSL_THROW_ON_CONTRACT_VIOLATION)
@ -172,7 +180,11 @@ endif()
#===============================================================================
add_library(faddeeva STATIC vendor/faddeeva/Faddeeva.cc)
target_include_directories(faddeeva PUBLIC vendor/faddeeva/)
target_include_directories(faddeeva
PUBLIC
$<INSTALL_INTERFACE:include/faddeeva>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/vendor/faddeeva>
)
target_compile_options(faddeeva PRIVATE ${cxxflags})
#===============================================================================
@ -283,7 +295,11 @@ set_target_properties(libopenmc PROPERTIES
OUTPUT_NAME openmc)
target_include_directories(libopenmc
PUBLIC include ${HDF5_INCLUDE_DIRS})
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
${HDF5_INCLUDE_DIRS}
)
# Set compile flags
target_compile_options(libopenmc PRIVATE ${cxxflags})
@ -336,19 +352,35 @@ set_target_properties(
add_custom_command(TARGET libopenmc POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE:libopenmc>
${CMAKE_CURRENT_SOURCE_DIR}/openmc/capi/$<TARGET_FILE_NAME:libopenmc>
${CMAKE_CURRENT_SOURCE_DIR}/openmc/lib/$<TARGET_FILE_NAME:libopenmc>
COMMENT "Copying libopenmc to Python module directory")
#===============================================================================
# Install executable, scripts, manpage, license
#===============================================================================
install(TARGETS openmc libopenmc
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(DIRECTORY src/relaxng DESTINATION share/openmc)
install(FILES man/man1/openmc.1 DESTINATION share/man/man1)
install(FILES LICENSE DESTINATION "share/doc/openmc" RENAME copyright)
install(DIRECTORY include/ DESTINATION include)
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/OpenMC)
install(TARGETS openmc libopenmc pugixml faddeeva gsl
EXPORT openmc-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(EXPORT openmc-targets
FILE OpenMCTargets.cmake
NAMESPACE OpenMC::
DESTINATION ${INSTALL_CONFIGDIR})
install(DIRECTORY src/relaxng DESTINATION ${CMAKE_INSTALL_DATADIR}/openmc)
install(FILES cmake/OpenMCConfig.cmake DESTINATION ${INSTALL_CONFIGDIR})
install(FILES man/man1/openmc.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
install(FILES LICENSE DESTINATION "${CMAKE_INSTALL_DOCDIR}" RENAME copyright)
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# Copy headers for vendored dependencies (note that xtensor/xtl are handled
# separately since they are managed by CMake)
install(DIRECTORY vendor/pugixml DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.hpp")
install(DIRECTORY vendor/gsl DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(DIRECTORY vendor/faddeeva DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

48
CODEOWNERS Normal file
View file

@ -0,0 +1,48 @@
# Data interface
openmc/data/ @paulromano
# Python bindings to C/C++ API
openmc/lib/ @paulromano
# Depletion
openmc/deplete/ @drewejohnson
tests/regression_tests/deplete/ @drewejohnson
tests/unit_tests/test_deplete_*.py @drewejohnson
# MG-related functionality
openmc/mgxs_library.py @nelsonag
src/mgxs.cpp @nelsonag
src/mgxs_interface.cpp @nelsonag
src/physics_mg.cpp @nelsonag
src/scattdata.cpp @nelsonag
src/xsdata.cpp @nelsonag
# CMFD
openmc/cmfd.py @shikhar413
src/cmfd_solver.cpp @shikhar413
# DAGMC
src/dagmc.cpp @pshriwise
tests/regression_tests/dagmc/ @pshriwise
tests/unit_tests/dagmc/ @pshriwise
# Photon transport
openmc/data/BREMX.DAT @amandalund
openmc/data/compton_profiles.h5 @amandalund
openmc/data/photon.py @amandalund
src/photon.cpp @amandalund
src/bremsstrahlung.cpp @amandalund
tests/regression_tests/photon_production/ @amandalund
tests/regression_tests/photon_source/ @amandalund
# RCP and TRISOs
openmc/model/triso.py @amandalund
tests/regression_tests/triso/ @amandalund
tests/unit_tests/test_model_triso.py @amandalund
# Geometry plotting
src/plot.cpp @pshriwise
openmc/lib/plot.py @pshriwise
# Resonance covariance
openmc/data/resonance_covariance.py @icmeyer

View file

@ -1,4 +1,4 @@
Copyright (c) 2011-2018 Massachusetts Institute of Technology and OpenMC contributors
Copyright (c) 2011-2019 Massachusetts Institute of Technology and OpenMC contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

8
cmake/OpenMCConfig.cmake Normal file
View file

@ -0,0 +1,8 @@
get_filename_component(OpenMC_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
find_package(xtl REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../xtl)
find_package(xtensor REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../xtensor)
if(NOT TARGET OpenMC::libopenmc)
include("${OpenMC_CMAKE_DIR}/OpenMCTargets.cmake")
endif()

View file

@ -1,3 +1,4 @@
sphinx-numfig
jupyter
sphinxcontrib-katex
sphinxcontrib-svg2pdfconverter

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

View file

@ -0,0 +1,9 @@
{{ fullname }}
{{ underline }}
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
:members:
:special-members: __call__

View file

@ -1,17 +1,17 @@
.. _capi:
=====
C API
=====
=========
C/C++ API
=========
The libopenmc shared library that is built when installing OpenMC exports a
number of C interoperable functions and global variables that can be used for
in-memory coupling. While it is possible to directly use the C API as documented
here for coupling, most advanced users will find it easier to work with the
Python bindings in the :py:mod:`openmc.capi` module.
in-memory coupling. While it is possible to directly use the C/C++ API as
documented here for coupling, most advanced users will find it easier to work
with the Python bindings in the :py:mod:`openmc.lib` module.
.. warning:: The C API is still experimental and may undergo substantial changes
in future releases.
.. warning:: The C/C++ API is still experimental and may undergo substantial
changes in future releases.
----------------
Type Definitions

View file

@ -27,7 +27,7 @@ MOCK_MODULES = [
'scipy.interpolate', 'scipy.integrate', 'scipy.optimize', 'scipy.special',
'scipy.stats', 'scipy.spatial', 'h5py', 'pandas', 'uncertainties',
'matplotlib', 'matplotlib.pyplot', 'openmoc',
'openmc.data.reconstruct'
'openmc.data.reconstruct', 'openmc.checkvalue'
]
sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES)
@ -56,7 +56,7 @@ extensions = ['sphinx.ext.autodoc',
'sphinx_numfig',
'notebook_sphinxext']
if not on_rtd:
extensions.append('sphinx.ext.imgconverter')
extensions.append('sphinxcontrib.rsvgconverter')
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@ -79,9 +79,9 @@ copyright = '2011-2019, Massachusetts Institute of Technology and OpenMC contrib
# built documents.
#
# The short X.Y version.
version = "0.11"
version = "0.12"
# The full version, including alpha/beta/rc tags.
release = "0.11.0-dev"
release = "0.12.0-dev"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View file

@ -5,27 +5,28 @@ Building Sphinx Documentation
=============================
In order to build the documentation in the ``docs`` directory, you will need to
have the `Sphinx <http://openmc.readthedocs.io/en/latest/>`_ third-party Python
have the `Sphinx <https://www.sphinx-doc.org/en/master/>`_ third-party Python
package. The easiest way to install Sphinx is via pip:
.. code-block:: sh
sudo pip install sphinx
pip install sphinx
Additionally, you will also need a Sphinx extension for numbering figures. The
`Numfig <http://openmc.readthedocs.io/en/latest/>`_ package can be installed
Additionally, you will need several Sphinx extensions that can be installed
directly with pip:
.. code-block:: sh
sudo pip install sphinx-numfig
pip install sphinx-numfig
pip install sphinxcontrib-katex
pip install sphinxcontrib-svg2pdfconverter
-----------------------------------
Building Documentation as a Webpage
-----------------------------------
To build the documentation as a webpage (what appears at
http://openmc.readthedocs.io), simply go to the ``docs`` directory and run:
https://docs.openmc.org), simply go to the ``docs`` directory and run:
.. code-block:: sh

View file

@ -19,7 +19,7 @@ build a Docker image with OpenMC installed. The image includes OpenMC with
MPICH and parallel HDF5 in the ``/opt/openmc`` directory, and
`Miniconda3 <https://conda.io/miniconda.html>`_ with all of the Python
pre-requisites (NumPy, SciPy, Pandas, etc.) installed. The
`NJOY2016 <http://www.njoy21.io/NJOY2016/>`_ codebase is installed in
`NJOY2016 <https://www.njoy21.io/NJOY2016/>`_ codebase is installed in
``/opt/NJOY2016`` to support full functionality and testing of the
``openmc.data`` Python module. The publicly available nuclear data libraries
necessary to run OpenMC's test suite -- including NNDC and WMP cross sections
@ -54,4 +54,3 @@ Docker container where you have access to use OpenMC.
.. _Docker container: https://www.docker.com/resources/what-container
.. _options: https://docs.docker.com/engine/reference/commandline/run/
.. _mounting volumes: https://docs.docker.com/storage/volumes/

View file

@ -207,8 +207,8 @@ Documentation
-------------
Classes, structs, and functions are to be annotated for the `Doxygen
<http://www.stack.nl/~dimitri/doxygen/>`_ documentation generation tool. Use the
``\`` form of Doxygen commands, e.g., ``\brief`` instead of ``@brief``.
<http://www.doxygen.nl/>`_ documentation generation tool. Use the ``\`` form of
Doxygen commands, e.g., ``\brief`` instead of ``@brief``.
------
Python
@ -231,7 +231,7 @@ represent a filesystem path should work with both strings and Path_ objects.
.. _C++ Core Guidelines: http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
.. _PEP8: https://www.python.org/dev/peps/pep-0008/
.. _numpydoc: https://numpydoc.readthedocs.io/en/latest/format.html
.. _numpy: http://www.numpy.org/
.. _numpy: https://numpy.org/
.. _scipy: https://www.scipy.org/
.. _matplotlib: https://matplotlib.org/
.. _pandas: https://pandas.pydata.org/

View file

@ -124,7 +124,7 @@ can interfere with virtual environments.
.. _GitHub: https://github.com/
.. _git flow: http://nvie.com/git-model
.. _valgrind: http://valgrind.org/
.. _style guide: http://openmc.readthedocs.io/en/latest/devguide/styleguide.html
.. _style guide: https://docs.openmc.org/en/latest/devguide/styleguide.html
.. _pull request: https://help.github.com/articles/using-pull-requests
.. _openmc-dev/openmc: https://github.com/openmc-dev/openmc
.. _paid plan: https://github.com/plans

View file

@ -24,6 +24,7 @@ General Usage
nuclear-data
nuclear-data-resonance-covariance
cad-geom
pincell-depletion
--------
Geometry

View file

@ -0,0 +1,14 @@
.. _notebook_depletion:
=================
Pincell Depletion
=================
.. only:: html
.. notebook:: ../../../examples/jupyter/pincell_depletion.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -2,12 +2,14 @@
The OpenMC Monte Carlo Code
===========================
OpenMC is a Monte Carlo particle transport simulation code focused on neutron
criticality calculations. It is capable of simulating 3D models based on
constructive solid geometry with second-order surfaces. OpenMC supports either
continuous-energy or multi-group transport. The continuous-energy particle
OpenMC is a community-developed Monte Carlo neutron and photon transport
simulation code. It is capable of performing fixed source, k-eigenvalue, and
subcritical multiplication calculations on models built using either a
constructive solid geometry or CAD representation. OpenMC supports both
continuous-energy and multigroup transport. The continuous-energy particle
interaction data is based on a native HDF5 format that can be generated from ACE
files used by the MCNP and Serpent Monte Carlo codes.
files produced by NJOY. Parallelism is enabled via a hybrid MPI and OpenMP
programming model.
OpenMC was originally developed by members of the `Computational Reactor Physics
Group <http://crpg.mit.edu>`_ at the `Massachusetts Institute of Technology

View file

@ -333,7 +333,7 @@ or sub-elements:
velocity sampling) or "dbrc" (Doppler broadening rejection correction).
Descriptions of each of these methods are documented here_.
.. _here: http://dx.doi.org/10.1016/j.anucene.2017.12.044
.. _here: https://doi.org/10.1016/j.anucene.2017.12.044
*Default*: "rvs"

View file

@ -109,6 +109,11 @@ The current version of the statepoint file format is 17.0.
**/tallies/tally <uid>/**
:Attributes:
- **internal** (*int*) -- Flag indicating the presence of tally
data (0) or absence of tally data (1). All user defined
tallies will have a value of 0 unless otherwise instructed.
:Datasets: - **n_realizations** (*int*) -- Number of realizations.
- **n_filters** (*int*) -- Number of filters used.
- **filters** (*int[]*) -- User-defined unique IDs of the filters on

View file

@ -23,6 +23,8 @@ The current version of the volume file format is 1.0.
bounding box
- **upper_right** (*double[3]*) -- Upper-right coordinates of
bounding box
- **threshold** (*double*) -- Threshold used for volume uncertainty
- **trigger_type** (*char[]*) -- Trigger type used for volume uncertainty
**/domain_<id>/**

View file

@ -538,7 +538,7 @@ Examples of CMFD simulations using OpenMC can be found in [HermanThesis]_.
.. rubric:: References
.. [BEAVRS] Nick Horelik, Bryan Herman. *Benchmark for Evaluation And Verification of Reactor
Simulations*. Massachusetts Institute of Technology, http://crpg.mit.edu/pub/beavrs
Simulations*. Massachusetts Institute of Technology, https://crpg.mit.edu/research/beavrs
, 2013.
.. [Gill] Daniel F. Gill. *Newton-Krylov methods for the solution of the k-eigenvalue problem in

View file

@ -8,13 +8,14 @@ Cross Section Representations
Continuous-Energy Data
----------------------
The data governing the interaction of neutrons with
various nuclei for continous-energy problems are represented using the ACE
format which is used by MCNP_ and Serpent_. ACE-format data can be generated
with the NJOY_ nuclear data processing system which converts raw
`ENDF/B data`_ into linearly-interpolable data as required by most Monte Carlo
codes. The use of a standard cross section format allows for a direct comparison
of OpenMC with other codes since the same cross section libraries can be used.
In OpenMC, the data governing the interaction of neutrons with various nuclei
for continous-energy problems are represented using an HDF5 format that can be
produced by converting files in the ACE format, which is used by MCNP_ and
Serpent_. ACE-format data can be generated with the NJOY_ nuclear data
processing system, which converts raw `ENDF/B data`_ into linearly-interpolable
data as required by most Monte Carlo codes. Since ACE-format data can be
converted into OpenMC's HDF5 format, it is possible to perform direct comparison
of OpenMC with other codes using the same underlying nuclear data library.
The ACE format contains continuous-energy cross sections for the following types
of reactions: elastic scattering, fission (or first-chance fission,
@ -31,7 +32,7 @@ data can be used.
Energy Grid Methods
-------------------
The method by which continuous energy cross sections for each nuclide in a
The method by which continuous-energy cross sections for each nuclide in a
problem are stored as a function of energy can have a substantial effect on the
performance of a Monte Carlo simulation. Since the ACE format is based on
linearly-interpolable cross sections, each nuclide has cross sections tabulated
@ -72,9 +73,9 @@ Windowed Multipole Representation
---------------------------------
In addition to the usual pointwise representation of cross sections, OpenMC
offers support for an experimental data format called windowed multipole (WMP).
This data format requires less memory than pointwise cross sections, and it
allows on-the-fly Doppler broadening to arbitrary temperature.
offers support for a data format called windowed multipole (WMP). This data
format requires less memory than pointwise cross sections, and it allows
on-the-fly Doppler broadening to arbitrary temperature.
The multipole method was introduced by Hwang_ and the faster windowed multipole
method by Josey_. In the multipole format, cross section resonances are
@ -258,7 +259,7 @@ where a material has a very large cross sections relative to the other material
used to minimize this error.
Finally, the above options for representing the physics do not have to be
consistent across the problem. The number of groups and the structure, however,
consistent across the problem. The number of groups and the structure, however,
does have to be consistent across the data sets. That is to say that each
microscopic or macroscopic data set does not have to apply the same scattering
expansion, treatment of multiplicity or angular representation of the cross
@ -269,11 +270,11 @@ or even isotropic scattering.
.. _logarithmic mapping technique:
https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-14-24530.pdf
.. _Hwang: http://www.ans.org/pubs/journals/nse/a_16381
.. _Josey: http://dx.doi.org/10.1016/j.jcp.2015.08.013
.. _Josey: https://doi.org/10.1016/j.jcp.2015.08.013
.. _WMP Library: https://github.com/mit-crpg/WMP_Library
.. _MCNP: http://mcnp.lanl.gov
.. _Serpent: http://montecarlo.vtt.fi
.. _NJOY: http://t2.lanl.gov/codes.shtml
.. _ENDF/B data: http://www.nndc.bnl.gov/endf
.. _Leppanen: http://dx.doi.org/10.1016/j.anucene.2009.03.019
.. _Leppanen: https://doi.org/10.1016/j.anucene.2009.03.019
.. _algorithms: http://ab-initio.mit.edu/wiki/index.php/Faddeeva_Package

View file

@ -0,0 +1,149 @@
.. _methods_heating:
=============================
Heating and Energy Deposition
=============================
As particles traverse a problem, some portion of their energy is deposited at
collision sites. This energy is deposited when charged particles, including
electrons and recoil nuclei, undergo electromagnetic interactions with
surrounding electons and ions. The information describing how much energy
is deposited for a specific reaction is referred to as
"heating numbers" and can be computed using a program like NJOY with the
``heatr`` module.
These heating rate is the product of reaction-specific coefficients and
a reaction cross section
.. math::
H(E) = \phi(E)\sum_i\rho_i\sum_rk_{i, r}(E),
and has units energy per time, typically eV / s.
Here, :math:`k_{i, r}` are the KERMA (Kinetic Energy Release in Materials)
[Mack97]_ coefficients for reaction :math:`r` of isotope :math:`i`.
The KERMA coefficients have units energy :math:`\times` cross-section, e.g.
eV-barn, and can be used much like a reaction cross section for the purpose
of tallying energy deposition.
KERMA coefficients can be computed using the energy-balance method with
a nuclear data processing code like NJOY, which performs the following
iteration over all reactions :math:`r` for all isotopes :math:`i`
requested
.. math::
k_{i, r}(E) = \left(E + Q_{i, r} - \bar{E}_{i, r, n}
- \bar{E}_{i, r, \gamma}\right)\sigma_{i, r}(E),
removing the energy of neutral particles (neutrons and photons) that are
transported away from the reaction site :math:`\bar{E}`, and the reaction
:math:`Q` value.
-------
Fission
-------
During a fission event, there are potentially many secondary particles, and all
must be considered. The total energy released in a fission event is typically
broken up into the following categories:
- :math:`E_{fr}` - kinetic energy of fission fragments
- :math:`E_{n,p}` - energy of prompt fission neutrons
- :math:`E_{n,d}` - energy of delayed fission neutrons
- :math:`E_{\gamma,p}` - energy of prompt fission photons
- :math:`E_{\gamma,d}` - energy of delayed fission photons
- :math:`E_{\beta}` - energy of released :math:`\beta` particles
- :math:`E_{\nu}` - energy of neutrinos
These components are defined in MF=1,MT=458 data in a standard ENDF/B-6 formatted
file. All these quantities may depend upon incident neutron energy,
but this dependence is not shown to make the following demonstrations cleaner.
As neutrinos scarcely interact with matter, the recoverable energy from
fission is defined as
.. math::
E_r\equiv E_{fr} + E_{n,p} + E_{n, d} + E_{\gamma, p}
+ E_{\gamma, d} + E_{\beta}
Furthermore, the energy of the secondary neutrons and photons is given as
:math:`E_{n, p}` and :math:`E_{\gamma, p}`, respectively.
NJOY computes the fission KERMA coefficient using this energy-balance method to be
.. math::
k_{i, f}(E) = \left[E + Q(E) - \bar{E}(E)\right]\sigma_{i, f}(E)
= \left[E_{fr} + E_{\gamma, p}\right]\sigma_{i, j}(E)
.. note::
The energy from delayed neutrons and photons and beta particles is intentionally
left out from the NJOY calculations.
---------------------
OpenMC Implementation
---------------------
For fissile isotopes, OpenMC makes modifications to the heating reaction to
include all relevant components of fission energy release. These modifications
are made to the total heating reaction, MT=301. Breaking the total heating
KERMA into a fission and non-fission section, one can write
.. math::
k_i(E) = k_{i, nf}(E) + \left[E_{fr}(E) + E_{\gamma, p}\right]\sigma_{i, f}(E)
OpenMC seeks to modify the total heating data to include energy from
:math:`\beta` particles and, conditionally, delayed photons. This conditional
inclusion depends on the simulation mode: neutron transport, or coupled
neutron-photon transport. The heating due to fission is removed using MT=318
data, and then re-built using the desired components of fission energy release
from MF=1,MT=458 data.
Neutron Transport
-----------------
For this case, OpenMC instructs ``heatr`` to produce heating coefficients
assuming that energy from photons, :math:`E_{\gamma, p}` and
:math:`E_{\gamma, d}`, is deposited at the fission site.
Let :math:`N901` represent the total heating number returned from this ``heatr``
run with :math:`N918` reflecting fission heating computed from NJOY.
:math:`M901` represent the following modification
.. math::
M901_{i}(E)\equiv N901_{i}(E) - N918_{i}(E)
+ \left[E_{i, fr} + E_{i, \beta} + E_{i, \gamma, p}
+ E_{i, \gamma, d}\right]\sigma_{i, f}(E).
This modified heating data is stored as the MT=901 reaction and will be scored
if ``heating-local`` is included in :attr:`openmc.Tally.scores`.
Coupled neutron-photon transport
--------------------------------
Here, OpenMC instructs ``heatr`` to assume that energy from photons is not
deposited locally. However, the definitions provided in the NJOY manual
indicate that, regardless of this mode, the prompt photon energy is still
included in :math:`k_{i, f}`, and therefore must be manually removed.
Let :math:`N301` represent the total heating number returned from this
``heatr`` run and :math:`M301` be
.. math::
M301_{i}(E)\equiv N301_{i}(E) - N318_{i}(E)
+ \left[E_{i, fr}(E) + E_{i, \beta}(E)\right]\sigma_{i, f}(E).
This modified heating data is stored as the MT=301 reaction and will be scored
if ``heating`` is included in :attr:`openmc.Tally.scores`.
----------
References
----------
.. [Mack97] Abdou, M.A., Maynard, C.W., and Wright, R.Q. MACK: computer
program to calculate neutron energy release parameters (fluence-to-kerma
factors) and multigroup neutron reaction cross sections from nuclear data
in ENDF Format. Oak Ridge National Laboratory report ORNL-TM-3994.

View file

@ -617,6 +617,10 @@ condition has been applied, the particle is killed and any surface current
tallies are scored to as needed. If a reflective boundary condition has been
applied to the surface, surface current tallies are scored to and then the
particle's direction is changed according to the procedure in :ref:`reflection`.
Note that the white boundary condition can be considered as the special case of
reflective boundary condition, where the same processing method will be applied to
deal with the surface current tallies scoring, except for determining the
changes of particle's direction according to the procedures in :ref:`white`.
Next, we need to determine what cell is beyond the surface in the direction of
travel of the particle so that we can evaluate cross sections based on its
@ -892,8 +896,72 @@ Dxy + Eyz + Fxz + Gx + Hy + Jz + K = 0`. Thus, the gradient to the surface is
\\ 2Cz + Ey + Fx + J \end{array} \right ).
.. _constructive solid geometry: http://en.wikipedia.org/wiki/Constructive_solid_geometry
.. _surfaces: http://en.wikipedia.org/wiki/Surface
.. _white:
-------------------------
White Boundary Conditions
-------------------------
The `white boundary condition <https://doi.org/10.1016/j.anucene.2019.05.006>`_
is usually applied in deterministic codes, where the particle will hit the
surface and travel back with isotropic angular distribution. The change in
particle's direction is sampled from a cosine distribution instead of uniform.
Figure :num:`fig-cosine-dist` shows an example of cosine-distribution reflection
on the arbitrary surface relative to the surface normal.
.. _fig-cosine-dist:
.. figure:: ../_images/cosine-dist.png
:align: center
:figclass: align-center
Cosine-distribution reflection on an arbitrary surface.
The probability density function (pdf) for the reflected direction can be
expressed as follows,
.. math::
:label: white-reflection-pdf
f(\mu, \phi) d\mu d\phi = \frac{\mu}{\pi} d\mu d\phi = 2\mu d\mu \frac{d\phi}{2\pi}
where :math:`\mu = \cos \theta` is the cosine of the polar angle between
reflected direction and the normal to the surface; and :math:`\theta` is the
azimuthal angle in :math:`[0,2\pi]`. We can separate the multivariate
probability density into two separate univariate density functions, one for
the cosine of the polar angle,
.. math::
:label: white-reflection-cosine
f(\mu) = 2\mu
and one for the azimuthal angle,
.. math::
:label: white-reflection-uniform
f(\phi) = \frac{1}{2\pi}.
Each of these density functions can be sampled by analytical inversion of the
cumulative distribution distribution, resulting in the following sampling
scheme:
.. math::
:label: white-reflection-sqrt-prn
\mu = \sqrt{\xi_1} \\
\phi = 2\pi\xi_2
where :math:`\xi_1` and :math:`\xi_2` are uniform random numbers on
:math:`[0,1)`. With the sampled values of :math:`\mu` and :math:`\phi`, the
final reflected direction vector can be computed via rotation of the surface
normal using the equations from :ref:`transform-coordinates`. The white boundary
condition can be applied to any kind of surface, as long as the normal to the
surface is known as in :ref:`reflection`.
.. _constructive solid geometry: https://en.wikipedia.org/wiki/Constructive_solid_geometry
.. _surfaces: https://en.wikipedia.org/wiki/Surface
.. _MCNP: http://mcnp.lanl.gov
.. _Serpent: http://montecarlo.vtt.fi
.. _Monte Carlo Performance benchmark: https://github.com/mit-crpg/benchmarks/tree/master/mc-performance/openmc

View file

@ -18,3 +18,4 @@ Theory and Methodology
eigenvalue
parallelization
cmfd
energy_deposition

View file

@ -139,9 +139,9 @@ be performed before the run is finished. This include the following:
- If requested, a source file is written to disk.
- All allocatable arrays are deallocated.
- Dynamically-allocated memory should be freed.
.. _probability distributions: http://en.wikipedia.org/wiki/Probability_distribution
.. _Monte Carlo: http://en.wikipedia.org/wiki/Monte_Carlo_method
.. _central limit theorem: http://en.wikipedia.org/wiki/Central_limit_theorem
.. _pseudorandom number: http://en.wikipedia.org/wiki/Pseudorandom_number_generator
.. _probability distributions: https://en.wikipedia.org/wiki/Probability_distribution
.. _Monte Carlo: https://en.wikipedia.org/wiki/Monte_Carlo_method
.. _central limit theorem: https://en.wikipedia.org/wiki/Central_limit_theorem
.. _pseudorandom number: https://en.wikipedia.org/wiki/Pseudorandom_number_generator

View file

@ -1298,11 +1298,10 @@ section over the range of velocities considered:
where it should be noted that the maximum is taken over the range :math:`[v_n -
4/\beta, 4_n + 4\beta]`. This method is known as Doppler broadening rejection
correction (DBRC) and was first introduced by `Becker et al.`_. OpenMC has an
implementation of DBRC as well as an accelerated sampling method that are
described fully in `Walsh et al.`_
implementation of DBRC as well as an accelerated sampling method that samples the `relative velocity`_ directly.
.. _Becker et al.: http://dx.doi.org/10.1016/j.anucene.2008.12.001
.. _Walsh et al.: http://dx.doi.org/10.1016/j.anucene.2014.01.017
.. _Becker et al.: https://doi.org/10.1016/j.anucene.2008.12.001
.. _relative velocity: https://doi.org/10.1016/j.anucene.2017.12.044
.. _sab_tables:
@ -1645,23 +1644,23 @@ another.
.. |sab| replace:: S(:math:`\alpha,\beta,T`)
.. _SIGMA1 method: http://dx.doi.org/10.13182/NSE76-1
.. _SIGMA1 method: https://doi.org/10.13182/NSE76-1
.. _scaled interpolation: http://www.ans.org/pubs/journals/nse/a_26575
.. _probability table method: http://dx.doi.org/10.13182/NSE72-3
.. _probability table method: https://doi.org/10.13182/NSE72-3
.. _Watt fission spectrum: http://dx.doi.org/10.1103/PhysRev.87.1037
.. _Watt fission spectrum: https://doi.org/10.1103/PhysRev.87.1037
.. _Foderaro: http://hdl.handle.net/1721.1/1716
.. _OECD: http://www.oecd-nea.org/dbprog/MMRW-BOOKS.html
.. _OECD: http://www.oecd-nea.org/tools/abstract/detail/NEA-1792
.. _NJOY: https://njoy.github.io/NJOY2016/
.. _NJOY: https://www.njoy21.io/NJOY2016/
.. _PREPRO: http://www-nds.iaea.org/ndspub/endf/prepro/
.. _ENDF-6 Format: http://www-nds.iaea.org/ndspub/documents/endf/endf102/endf102.pdf
.. _ENDF-6 Format: https://www.oecd-nea.org/dbdata/data/manual-endf/endf102.pdf
.. _Monte Carlo Sampler: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-9721.pdf
@ -1669,7 +1668,7 @@ another.
.. _MC21: http://www.osti.gov/bridge/servlets/purl/903083-HT5p1o/903083.pdf
.. _Romano: http://dx.doi.org/10.1016/j.cpc.2014.11.001
.. _Romano: https://doi.org/10.1016/j.cpc.2014.11.001
.. _Sutton and Brown: http://www.osti.gov/bridge/product.biblio.jsp?osti_id=307911

View file

@ -607,33 +607,33 @@ is actually independent of the number of nodes:
Radiation Penetration Calculations on a Parallel Computer,"
*Trans. Am. Nucl. Soc.*, **17**, 260 (1973).
.. _first paper: http://www.jstor.org/stable/2280232
.. _first paper: https://doi.org/10.2307/2280232
.. _work of Forrest Brown: http://hdl.handle.net/2027.42/24996
.. _Brissenden and Garlick: http://dx.doi.org/10.1016/0306-4549(86)90095-2
.. _Brissenden and Garlick: https://doi.org/10.1016/0306-4549(86)90095-2
.. _MPICH2: http://www.mcs.anl.gov/mpi/mpich
.. _binomial tree: http://www.cs.auckland.ac.nz/~jmor159/PLDS210/trees.html
.. _binomial tree: https://www.mcs.anl.gov/~thakur/papers/ijhpca-coll.pdf
.. _Geary: http://www.jstor.org/stable/10.2307/2342070
.. _Geary: https://doi.org/10.2307/2342070
.. _Barnett: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.51.7772
.. _single-instruction multiple-data: http://en.wikipedia.org/wiki/SIMD
.. _single-instruction multiple-data: https://en.wikipedia.org/wiki/SIMD
.. _vector computers: http://en.wikipedia.org/wiki/Vector_processor
.. _vector computers: https://en.wikipedia.org/wiki/Vector_processor
.. _single program multiple data: http://en.wikipedia.org/wiki/SPMD
.. _single program multiple data: https://en.wikipedia.org/wiki/SPMD
.. _message-passing interface: http://en.wikipedia.org/wiki/Message_Passing_Interface
.. _message-passing interface: https://en.wikipedia.org/wiki/Message_Passing_Interface
.. _PVM: http://www.csm.ornl.gov/pvm/pvm_home.html
.. _MPI: http://www.mcs.anl.gov/research/projects/mpi/
.. _embarrassingly parallel: http://en.wikipedia.org/wiki/Embarrassingly_parallel
.. _embarrassingly parallel: https://en.wikipedia.org/wiki/Embarrassingly_parallel
.. _sends: http://www.mcs.anl.gov/research/projects/mpi/www/www3/MPI_Send.html
@ -643,8 +643,8 @@ is actually independent of the number of nodes:
.. _allgather: http://www.mcs.anl.gov/research/projects/mpi/www/www3/MPI_Allgather.html
.. _Cauchy distribution: http://en.wikipedia.org/wiki/Cauchy_distribution
.. _Cauchy distribution: https://en.wikipedia.org/wiki/Cauchy_distribution
.. _latency: http://en.wikipedia.org/wiki/Latency_(engineering)#Packet-switched_networks
.. _latency: https://en.wikipedia.org/wiki/Latency_(engineering)#Packet-switched_networks
.. _bandwidth: http://en.wikipedia.org/wiki/Bandwidth_(computing)
.. _bandwidth: https://en.wikipedia.org/wiki/Bandwidth_(computing)

View file

@ -579,7 +579,7 @@ sampled using the leading order term of the SauterGlucksternHull
distribution,
.. math::
:label: sauterglucksternhull
:label: sauter-gluckstern-hull
p(\mu_{\pm}) = C(1 - \beta_{\pm}\mu_{\pm})^{-2},
@ -588,7 +588,7 @@ ratio of the velocity of the charged particle to the speed of light given in
:eq:`beta-2`.
The inverse transform method is used to sample :math:`\mu_{-}` and
:math:`\mu_{+}` from :eq:`sauterglucksternhull`, using the sampling formula
:math:`\mu_{+}` from :eq:`sauter-gluckstern-hull`, using the sampling formula
.. math::
:label: sample-mu

View file

@ -67,6 +67,6 @@ the idea is to determine the new multiplicative and additive constants in
.. rubric:: References
.. _L'Ecuyer: http://dx.doi.org/10.1090/S0025-5718-99-00996-5
.. _L'Ecuyer: https://doi.org/10.1090/S0025-5718-99-00996-5
.. _Brown: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/anl-rn-arb-stride.pdf
.. _linear congruential generator: http://en.wikipedia.org/wiki/Linear_congruential_generator
.. _linear congruential generator: https://en.wikipedia.org/wiki/Linear_congruential_generator

View file

@ -484,31 +484,31 @@ improve the estimate of the percentile.
.. rubric:: References
.. _following approximation: http://dx.doi.org/10.1080/03610918708812641
.. _following approximation: https://doi.org/10.1080/03610918708812641
.. _Bessel's correction: http://en.wikipedia.org/wiki/Bessel's_correction
.. _Bessel's correction: https://en.wikipedia.org/wiki/Bessel's_correction
.. _random variable: http://en.wikipedia.org/wiki/Random_variable
.. _random variable: https://en.wikipedia.org/wiki/Random_variable
.. _stochastic process: http://en.wikipedia.org/wiki/Stochastic_process
.. _stochastic process: https://en.wikipedia.org/wiki/Stochastic_process
.. _independent, identically-distributed random variables: http://en.wikipedia.org/wiki/Independent_and_identically_distributed_random_variables
.. _independent, identically-distributed random variables: https://en.wikipedia.org/wiki/Independent_and_identically_distributed_random_variables
.. _law of large numbers: http://en.wikipedia.org/wiki/Law_of_large_numbers
.. _law of large numbers: https://en.wikipedia.org/wiki/Law_of_large_numbers
.. _expected value: http://en.wikipedia.org/wiki/Expected_value
.. _expected value: https://en.wikipedia.org/wiki/Expected_value
.. _converges in probability: http://en.wikipedia.org/wiki/Convergence_of_random_variables#Convergence_in_probability
.. _converges in probability: https://en.wikipedia.org/wiki/Convergence_of_random_variables#Convergence_in_probability
.. _normal distribution: http://en.wikipedia.org/wiki/Normal_distribution
.. _normal distribution: https://en.wikipedia.org/wiki/Normal_distribution
.. _converges in distribution: http://en.wikipedia.org/wiki/Convergence_of_random_variables#Convergence_in_distribution
.. _converges in distribution: https://en.wikipedia.org/wiki/Convergence_of_random_variables#Convergence_in_distribution
.. _confidence intervals: http://en.wikipedia.org/wiki/Confidence_interval
.. _confidence intervals: https://en.wikipedia.org/wiki/Confidence_interval
.. _Student's t-distribution: http://en.wikipedia.org/wiki/Student%27s_t-distribution
.. _Student's t-distribution: https://en.wikipedia.org/wiki/Student%27s_t-distribution
.. _Cauchy distribution: http://en.wikipedia.org/wiki/Cauchy_distribution
.. _Cauchy distribution: https://en.wikipedia.org/wiki/Cauchy_distribution
.. _unpublished rational approximation: https://web.archive.org/web/20150926021742/http://home.online.no/~pjacklam/notes/invnorm/

View file

@ -58,7 +58,8 @@ Coupling and Multi-physics
--------------------------
- Miriam A. Kreher, Benoit Forget, and Kord Smith, "Single-Batch Monte Carlo
Multiphysics Coupling," *Proc. M&C*, Portland, Oregon, Aug. 25-29 (2019).
Multiphysics Coupling," *Proc. M&C*, 1789-1797, Portland, Oregon, Aug. 25-29
(2019).
- Ze-Long Zhao, Yongwei Yang, and Shuang Hong, "`Application of FLUKA and OpenMC
in coupled physics calculation of target and subcritical reactor for ADS
@ -118,7 +119,7 @@ Geometry and Visualization
- Sterling Harper, Paul Romano, Benoit Forget, and Kord Smith, "Efficient
dynamic threadsafe neighbor lists for Monte Carlo ray tracing," *Proc. M&C*,
Portland, Oregon, Aug. 25-29 (2019).
918-926, Portland, Oregon, Aug. 25-29 (2019).
- Jin-Yang Li, Long Gu, Hu-Shan Xu, Nadezha Korepanova, Rui Yu, Yan-Lei Zhu, and
Chang-Ping Qin, "`CAD modeling study on FLUKA and OpenMC for accelerator
@ -141,6 +142,10 @@ Geometry and Visualization
Miscellaneous
-------------
- Shikhar Kumar, Benoit Forget, and Kord Smith, "Analysis of fission source
convergence for a 3-D SMR core using functional expansion tallies," *Proc.
M&C*, 937-947, Portland, Oregon, Aug. 25-29 (2019).
- Faisal Qayyum, Muhammad R. Ali, Awais Zahur, and R. Khan, "`Improvements in
methodology to determine feedback reactivity coefficients
<https://doi.org/10.1007/s41365-019-0588-0>`_," *Nucl. Sci. Tech.*, **30**: 63
@ -361,7 +366,7 @@ Nuclear Data
- Jonathan A. Walsh, Benoit Forget, Kord S. Smith, and Forrest B. Brown,
"`Uncertainty in Fast Reactor-Relevant Critical Benchmark Simulations Due to
Unresolved Resonance Structure
<https://www.kns.org/paper_file/paper/MC2017_2017_3/P197S03-09WalshJ.pdf>`_,"
<https://www.kns.org/files/int_paper/paper/MC2017_2017_3/P197S03-09WalshJ.pdf>`_,"
*Proc. Int. Conf. Mathematics & Computational Methods Applied to Nuclear
Science and Engineering*, Jeju, Korea, Apr. 16-20, 2017.
@ -404,7 +409,7 @@ Parallelism
- Paul K. Romano and Andrew R. Siegel, "`Limits on the efficiency of event-based
algorithms for Monte Carlo neutron transport
<https://www.kns.org/paper_file/paper/MC2017_2017_2/P099S02-02RomanoP.pdf>`_,"
<https://www.kns.org/files/int_paper/paper/MC2017_2017_2/P099S02-02RomanoP.pdf>`_,"
*Proc. Int. Conf. Mathematics & Computational Methods Applied to Nuclear
Science and Engineering*, Jeju, Korea, Apr. 16-20, 2017.
@ -496,7 +501,7 @@ Depletion
- Jose L. Salcedo-Perez, Benoit Forget, Kord Smith, and Paul Romano, "Hybrid
tallies to improve performance in depletion Monte Carlo simulations," *Proc.
M&C*, Aug. 25-29 (2019).
M&C*, 927-936, Portland, Oregon, Aug. 25-29 (2019).
- Zhao-Qing Liu, Ze-Long Zhao, Yong-Wei Yang, Yu-Cui Gao, Hai-Yan Meng, and
Qing-Yu Gao, "`Development and validation of depletion code system IMPC-Burnup
@ -526,6 +531,10 @@ Depletion
Sensitivity Analysis
--------------------
- Abdulla Alhajri and Benoit Forget, "Eigenvalue Sensitivity in Monte Carlo
Simulations to Nuclear Data Parameters using the Multipole Formalism," *Proc.
M&C*, 1895-1906, Portland, Oregon, Aug. 25-29 (2019).
- Xingjie Peng, Jingang Liang, Benoit Forget, and Kord Smith, "`Calculation of
adjoint-weighted reactor kinetics parameters in OpenMC
<https://doi.org/10.1016/j.anucene.2019.01.007>`_", *Ann. Nucl. Energy*,

View file

@ -1,8 +1,8 @@
--------------------------------------------------
:mod:`openmc.capi` -- Python bindings to the C API
--------------------------------------------------
------------------------------------------------------
:mod:`openmc.lib` -- Python bindings to the C/C++ API
------------------------------------------------------
.. automodule:: openmc.capi
.. automodule:: openmc.lib
Functions
---------

View file

@ -2,6 +2,8 @@
:mod:`openmc.data` -- Nuclear Data Interface
--------------------------------------------
.. module:: openmc.data
Core Classes
------------
@ -13,15 +15,15 @@ and product yields.
:nosignatures:
:template: myclass.rst
openmc.data.IncidentNeutron
openmc.data.Reaction
openmc.data.Product
openmc.data.FissionEnergyRelease
openmc.data.DataLibrary
openmc.data.Decay
openmc.data.FissionProductYields
openmc.data.WindowedMultipole
openmc.data.ProbabilityTables
IncidentNeutron
Reaction
Product
FissionEnergyRelease
DataLibrary
Decay
FissionProductYields
WindowedMultipole
ProbabilityTables
The following classes are used for storing atomic data (incident photon cross
sections, atomic relaxation):
@ -31,9 +33,9 @@ sections, atomic relaxation):
:nosignatures:
:template: myclass.rst
openmc.data.IncidentPhoton
openmc.data.PhotonReaction
openmc.data.AtomicRelaxation
IncidentPhoton
PhotonReaction
AtomicRelaxation
The following classes are used for storing thermal neutron scattering data:
@ -43,10 +45,10 @@ The following classes are used for storing thermal neutron scattering data:
:nosignatures:
:template: myclass.rst
openmc.data.ThermalScattering
openmc.data.ThermalScatteringReaction
openmc.data.CoherentElastic
openmc.data.IncoherentElastic
ThermalScattering
ThermalScatteringReaction
CoherentElastic
IncoherentElastic
Core Functions
@ -57,12 +59,12 @@ Core Functions
:nosignatures:
:template: myfunction.rst
openmc.data.atomic_mass
openmc.data.gnd_name
openmc.data.linearize
openmc.data.thin
openmc.data.water_density
openmc.data.zam
atomic_mass
gnd_name
linearize
thin
water_density
zam
One-dimensional Functions
-------------------------
@ -72,13 +74,13 @@ One-dimensional Functions
:nosignatures:
:template: myclass.rst
openmc.data.Function1D
openmc.data.Tabulated1D
openmc.data.Polynomial
openmc.data.Combination
openmc.data.Sum
openmc.data.Regions1D
openmc.data.ResonancesWithBackground
Function1D
Tabulated1D
Polynomial
Combination
Sum
Regions1D
ResonancesWithBackground
Angle-Energy Distributions
--------------------------
@ -88,27 +90,27 @@ Angle-Energy Distributions
:nosignatures:
:template: myclass.rst
openmc.data.AngleEnergy
openmc.data.KalbachMann
openmc.data.CorrelatedAngleEnergy
openmc.data.UncorrelatedAngleEnergy
openmc.data.NBodyPhaseSpace
openmc.data.LaboratoryAngleEnergy
openmc.data.AngleDistribution
openmc.data.EnergyDistribution
openmc.data.ArbitraryTabulated
openmc.data.GeneralEvaporation
openmc.data.MaxwellEnergy
openmc.data.Evaporation
openmc.data.WattEnergy
openmc.data.MadlandNix
openmc.data.DiscretePhoton
openmc.data.LevelInelastic
openmc.data.ContinuousTabular
openmc.data.CoherentElasticAE
openmc.data.IncoherentElasticAE
openmc.data.IncoherentElasticAEDiscrete
openmc.data.IncoherentInelasticAEDiscrete
AngleEnergy
KalbachMann
CorrelatedAngleEnergy
UncorrelatedAngleEnergy
NBodyPhaseSpace
LaboratoryAngleEnergy
AngleDistribution
EnergyDistribution
ArbitraryTabulated
GeneralEvaporation
MaxwellEnergy
Evaporation
WattEnergy
MadlandNix
DiscretePhoton
LevelInelastic
ContinuousTabular
CoherentElasticAE
IncoherentElasticAE
IncoherentElasticAEDiscrete
IncoherentInelasticAEDiscrete
Resonance Data
--------------
@ -118,20 +120,20 @@ Resonance Data
:nosignatures:
:template: myclass.rst
openmc.data.Resonances
openmc.data.ResonanceRange
openmc.data.SingleLevelBreitWigner
openmc.data.MultiLevelBreitWigner
openmc.data.ReichMoore
openmc.data.RMatrixLimited
openmc.data.ResonanceCovariances
openmc.data.ResonanceCovarianceRange
openmc.data.SingleLevelBreitWignerCovariance
openmc.data.MultiLevelBreitWignerCovariance
openmc.data.ReichMooreCovariance
openmc.data.ParticlePair
openmc.data.SpinGroup
openmc.data.Unresolved
Resonances
ResonanceRange
SingleLevelBreitWigner
MultiLevelBreitWigner
ReichMoore
RMatrixLimited
ResonanceCovariances
ResonanceCovarianceRange
SingleLevelBreitWignerCovariance
MultiLevelBreitWignerCovariance
ReichMooreCovariance
ParticlePair
SpinGroup
Unresolved
ACE Format
----------
@ -144,8 +146,8 @@ Classes
:nosignatures:
:template: myclass.rst
openmc.data.ace.Library
openmc.data.ace.Table
ace.Library
ace.Table
Functions
+++++++++
@ -155,7 +157,7 @@ Functions
:nosignatures:
:template: myfunction.rst
openmc.data.ace.ascii_to_binary
ace.ascii_to_binary
ENDF Format
-----------
@ -168,7 +170,7 @@ Classes
:nosignatures:
:template: myclass.rst
openmc.data.endf.Evaluation
endf.Evaluation
Functions
+++++++++
@ -178,13 +180,13 @@ Functions
:nosignatures:
:template: myfunction.rst
openmc.data.endf.float_endf
openmc.data.endf.get_cont_record
openmc.data.endf.get_evaluations
openmc.data.endf.get_head_record
openmc.data.endf.get_tab1_record
openmc.data.endf.get_tab2_record
openmc.data.endf.get_text_record
endf.float_endf
endf.get_cont_record
endf.get_evaluations
endf.get_head_record
endf.get_tab1_record
endf.get_tab2_record
endf.get_text_record
NJOY Interface
--------------
@ -194,7 +196,7 @@ NJOY Interface
:nosignatures:
:template: myfunction.rst
openmc.data.njoy.run
openmc.data.njoy.make_pendf
openmc.data.njoy.make_ace
openmc.data.njoy.make_ace_thermal
njoy.run
njoy.make_pendf
njoy.make_ace
njoy.make_ace_thermal

View file

@ -1,12 +1,27 @@
.. _pythonapi_deplete:
.. module:: openmc.deplete
----------------------------------
:mod:`openmc.deplete` -- Depletion
----------------------------------
.. module:: openmc.deplete
Primary API
-----------
Several classes are provided that implement different time-integration
The two primary requirements to perform depletion with :mod:`openmc.deplete`
are:
1) A transport operator
2) A time-integration scheme
The former is responsible for executing a transport code, like OpenMC,
and retaining important information required for depletion. The most common examples
are reaction rates and power normalization data. The latter is responsible for
projecting reaction rates and compositions forward in calendar time across
some step size :math:`\Delta t`, and obtaining new compositions given a power
or power density. The :class:`Operator` is provided to handle communicating with
OpenMC. Several classes are provided that implement different time-integration
algorithms for depletion calculations, which are described in detail in Colin
Josey's thesis, `Development and analysis of high order neutron
transport-depletion coupling algorithms <http://hdl.handle.net/1721.1/113721>`_.
@ -31,14 +46,46 @@ specific to OpenMC is available using the following class:
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
:template: mycallable.rst
Operator
When running in parallel using `mpi4py <http://mpi4py.scipy.org>`_, the MPI
intercommunicator used can be changed by modifying the following module
variable. If it is not explicitly modified, it defaults to
``mpi4py.MPI.COMM_WORLD``.
The :class:`Operator` must also have some knowledge of how nuclides transmute
and decay. This is handled by the :class:`Chain`.
Minimal Example
---------------
A minimal example for performing depletion would be:
.. code::
>>> import openmc
>>> import openmc.deplete
>>> geometry = openmc.Geometry.from_xml()
>>> settings = openmc.Settings.from_xml()
# Representation of a depletion chain
>>> chain_file = "chain_casl.xml"
>>> operator = openmc.deplete.Operator(
... geometry, settings, chain_file)
# Set up 5 time steps of one day each
>>> dt = [24 * 60 * 60] * 5
>>> power = 1e6 # constant power of 1 MW
# Deplete using mid-point predictor-corrector
>>> cecm = openmc.deplete.CECMIntegrator(
... operator, dt, power)
>>> cecm.integrate()
Internal Classes and Functions
------------------------------
When running in parallel using `mpi4py
<https://mpi4py.readthedocs.io/en/stable/>`_, the MPI intercommunicator used can
be changed by modifying the following module variable. If it is not explicitly
modified, it defaults to ``mpi4py.MPI.COMM_WORLD``.
.. data:: comm
@ -46,9 +93,6 @@ variable. If it is not explicitly modified, it defaults to
:type: mpi4py.MPI.Comm
Internal Classes and Functions
------------------------------
During a depletion calculation, the depletion chain, reaction rates, and number
densities are managed through a series of internal classes that are not normally
visible to a user. However, should you find yourself wondering about these
@ -82,6 +126,26 @@ data, such as number densities and reaction rates for each material.
Results
ResultsList
The following class and functions are used to solve the depletion equations,
with :func:`cram.CRAM48` being the default.
.. autosummary::
:toctree: generated
:nosignatures:
:template: myintegrator.rst
cram.IPFCramSolver
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
cram.CRAM16
cram.CRAM48
cram.deplete
cram.timed_deplete
The following classes are used to help the :class:`openmc.deplete.Operator`
compute quantities like effective fission yields, reaction rates, and
total system energy.
@ -95,40 +159,47 @@ total system energy.
helpers.ChainFissionHelper
helpers.ConstantFissionYieldHelper
helpers.DirectReactionRateHelper
helpers.EnergyScoreHelper
helpers.FissionYieldCutoffHelper
The following classes are abstract classes that can be used to extend the
:mod:`openmc.deplete` capabilities:
Abstract Base Classes
---------------------
A good starting point for extending capabilities in :mod:`openmc.deplete` is
to examine the following abstract base classes. Custom classes can
inherit from :class:`abc.TransportOperator` to implement alternative
schemes for collecting reaction rates and other data from a transport code
prior to depleting materials
.. autosummary::
:toctree: generated
:nosignatures:
:template: mycallable.rst
abc.TransportOperator
The following classes are abstract classes used to pass information from
OpenMC simulations back on to the :class:`abc.TransportOperator`
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
EnergyHelper
FissionYieldHelper
ReactionRateHelper
TalliedFissionYieldHelper
TransportOperator
abc.EnergyHelper
abc.FissionYieldHelper
abc.ReactionRateHelper
abc.TalliedFissionYieldHelper
Custom integrators can be developed by subclassing from the following abstract
base classes:
Custom integrators or depletion solvers can be developed by subclassing from
the following abstract base classes:
.. autosummary::
:toctree: generated
:nosignatures:
:template: myintegrator.rst
Integrator
SIIntegrator
Each of the integrator classes also relies on a number of "helper" functions
as follows:
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
cram.CRAM16
cram.CRAM48
abc.Integrator
abc.SIIntegrator
abc.DepSystemSolver

View file

@ -27,7 +27,7 @@ there are many substantial benefits to using the Python API, including:
For those new to Python, there are many good tutorials available online. We
recommend going through the modules from `Codecademy
<https://www.codecademy.com/tracks/python>`_ and/or the `Scipy lectures
<https://www.codecademy.com/learn/learn-python-3>`_ and/or the `Scipy lectures
<https://scipy-lectures.github.io/>`_.
The full API documentation serves to provide more information on a given module

View file

@ -2,11 +2,6 @@
What's New in 0.11.0
====================
.. note::
These release notes are for a future release of OpenMC and are still subject
to change. The new features and bug fixes documented here reflect the
current status of the ``develop`` branch of OpenMC.
.. currentmodule:: openmc
-------
@ -17,7 +12,7 @@ This release of OpenMC adds several major new features: :ref:`depletion
<usersguide_depletion>`, photon transport, and support for CAD geometries
through DAGMC. In addition, the core codebase has been rewritten in C++14 (it
was previously written in Fortran 2008). This makes compiling the code
cosiderably simpler as no Fortran compiler is needed.
considerably simpler as no Fortran compiler is needed.
Functional expansion tallies are now supported through several new tally filters
that can be arbitrarily combined:
@ -40,13 +35,16 @@ random, non-overlapping configuration of spheres within the region.
New Features
------------
- White boundary conditions can be applied to surfaces
- Support for rectilinear meshes through :class:`openmc.RectilinearMesh`.
- The :class:`Geometry`, :class:`Materials`, and :class:`Settings` classes now
have a ``from_xml`` method that will build an instance from an existing XML
file.
- Predefined energy group structures can be found in
:data:`openmc.mgxs.GROUP_STRUCTURES`.
- New tally scores: ``H1-production``, ``H2-production``, ``H3-production``,
``He3-production``, ``He4-production``, ``heating``, and ``damage-energy``
``He3-production``, ``He4-production``, ``heating``, ``heating-local``, and
``damage-energy``.
- Switched to cell-based neighor lists (`PR 1140
<https://github.com/openmc-dev/openmc/pull/1140>`_)
- Two new probability distributions that can be used for source distributions:
@ -54,11 +52,40 @@ New Features
- The :mod:`openmc.data` module now supports reading and sampling from ENDF File
32 resonance covariance data (`PR 1024
<https://github.com/openmc-dev/openmc/pull/1024>`_).
- Several new convenience functions/methods have been added:
- The :func:`openmc.model.cylinder_from_points` function creates a cylinder
given two points passing through its center and a radius.
- The :meth:`openmc.Plane.from_points` function creates a plane given three
points that pass through it.
- The :func:`openmc.model.pin` function creates a pin cell universe given a
sequence of concentric cylinders and materials.
------------------
Python API Changes
------------------
- All surface classes now have coefficient arguments given as lowercase names.
- The order of arguments in surface classes has been changed so that
coefficients are the first arguments (rather than the optional surface ID).
This means you can now write::
x = openmc.XPlane(5.0, 'reflective')
zc = openmc.ZCylinder(0., 0., 10.)
- The ``Mesh`` class has been renamed :class:`openmc.RegularMesh`.
- The ``get_rectangular_prism`` function has been renamed
:func:`openmc.model.rectangular_prism`.
- The ``get_hexagonal_prism`` function has been renamed
:func:`openmc.model.hexagonal_prism`.
- Python bindings to the C/C++ API have been move from ``openmc.capi`` to
:mod:`openmc.lib`.
---------
Bug Fixes
---------
- `Rotate azimuthal distributions correctly for source sampling <https://github.com/openmc-dev/openmc/pull/1363>`_
- `Fix reading ASCII ACE tables in Python 3 <https://github.com/openmc-dev/openmc/pull/1176>`_
- `Fix bug for distributed temperatures <https://github.com/openmc-dev/openmc/pull/1178>`_
- `Fix bug for distance to boundary in complex cells <https://github.com/openmc-dev/openmc/pull/1172>`_
@ -77,6 +104,7 @@ This release contains new contributions from the following people:
- `Brody Bassett <https://github.com/brbass>`_
- `Will Boyd <https://github.com/wbinventor>`_
- `Andrew Davis <https://github.com/makeclean>`_
- `Iurii Drobyshev <https://github.com/dryuri92>`_
- `Guillaume Giudicelli <https://github.com/GiudGiud>`_
- `Brittany Grayson <https://github.com/graybri3>`_
- `Zhuoran Han <https://github.com/hanzhuoran>`_
@ -94,9 +122,12 @@ This release contains new contributions from the following people:
- `Isaac Meyer <https://github.com/icmeyer>`_
- `April Novak <https://github.com/aprilnovak>`_
- `Adam Nelson <https://github.com/nelsonag>`_
- `Gavin Ridley <https://github.com/gridley>`_
- `Jose Salcedo Perez <https://github.com/salcedop>`_
- `Paul Romano <https://github.com/paulromano>`_
- `Sam Shaner <https://github.com/samuelshaner>`_
- `Jonathan Shimwell <https://github.com/Shimwell>`_
- `Patrick Shriwise <https://github.com/pshriwise>`_
- `John Tramm <https://github.com/jtramm>`_
- `Jiankai Yu <https://github.com/rockfool>`_
- `Xiaokang Zhang <https://github.com/zxkjack123>`_

View file

@ -45,9 +45,9 @@ Bug Fixes
- `95cfac`_: Fixed error in cell neighbor searches.
- `83a803`_: Fixed bug related to probability tables.
.. _b206a8: https://github.com/mit-crpg/openmc/commit/b206a8
.. _800742: https://github.com/mit-crpg/openmc/commit/800742
.. _a07c08: https://github.com/mit-crpg/openmc/commit/a07c08
.. _a75283: https://github.com/mit-crpg/openmc/commit/a75283
.. _95cfac: https://github.com/mit-crpg/openmc/commit/95cfac
.. _83a803: https://github.com/mit-crpg/openmc/commit/83a803
.. _b206a8: https://github.com/openmc-dev/openmc/commit/b206a8
.. _800742: https://github.com/openmc-dev/openmc/commit/800742
.. _a07c08: https://github.com/openmc-dev/openmc/commit/a07c08
.. _a75283: https://github.com/openmc-dev/openmc/commit/a75283
.. _95cfac: https://github.com/openmc-dev/openmc/commit/95cfac
.. _83a803: https://github.com/openmc-dev/openmc/commit/83a803

View file

@ -42,13 +42,13 @@ Bug Fixes
- d050c7_: Added Bessel's correction to make estimate of variance unbiased.
- 2a5b9c_: Fixed regression in plotting.
.. _a27f8f: https://github.com/mit-crpg/openmc/commit/a27f8f
.. _afe121: https://github.com/mit-crpg/openmc/commit/afe121
.. _e0968e: https://github.com/mit-crpg/openmc/commit/e0968e
.. _298db8: https://github.com/mit-crpg/openmc/commit/298db8
.. _2f3bbe: https://github.com/mit-crpg/openmc/commit/2f3bbe
.. _671f30: https://github.com/mit-crpg/openmc/commit/671f30
.. _b2c40e: https://github.com/mit-crpg/openmc/commit/b2c40e
.. _5524fd: https://github.com/mit-crpg/openmc/commit/5524fd
.. _d050c7: https://github.com/mit-crpg/openmc/commit/d050c7
.. _2a5b9c: https://github.com/mit-crpg/openmc/commit/2a5b9c
.. _a27f8f: https://github.com/openmc-dev/openmc/commit/a27f8f
.. _afe121: https://github.com/openmc-dev/openmc/commit/afe121
.. _e0968e: https://github.com/openmc-dev/openmc/commit/e0968e
.. _298db8: https://github.com/openmc-dev/openmc/commit/298db8
.. _2f3bbe: https://github.com/openmc-dev/openmc/commit/2f3bbe
.. _671f30: https://github.com/openmc-dev/openmc/commit/671f30
.. _b2c40e: https://github.com/openmc-dev/openmc/commit/b2c40e
.. _5524fd: https://github.com/openmc-dev/openmc/commit/5524fd
.. _d050c7: https://github.com/openmc-dev/openmc/commit/d050c7
.. _2a5b9c: https://github.com/openmc-dev/openmc/commit/2a5b9c

View file

@ -40,12 +40,12 @@ Bug Fixes
- 3212f5_: Fixed issue with blank line at beginning of XML files.
.. _nelsonag: https://github.com/nelsonag
.. _33f29a: https://github.com/mit-crpg/openmc/commit/33f29a
.. _1c472d: https://github.com/mit-crpg/openmc/commit/1c472d
.. _3c6e80: https://github.com/mit-crpg/openmc/commit/3c6e80
.. _3bd35b: https://github.com/mit-crpg/openmc/commit/3bd35b
.. _0069d5: https://github.com/mit-crpg/openmc/commit/0069d5
.. _7af2cf: https://github.com/mit-crpg/openmc/commit/7af2cf
.. _460ef1: https://github.com/mit-crpg/openmc/commit/460ef1
.. _85a60e: https://github.com/mit-crpg/openmc/commit/85a60e
.. _3212f5: https://github.com/mit-crpg/openmc/commit/3212f5
.. _33f29a: https://github.com/openmc-dev/openmc/commit/33f29a
.. _1c472d: https://github.com/openmc-dev/openmc/commit/1c472d
.. _3c6e80: https://github.com/openmc-dev/openmc/commit/3c6e80
.. _3bd35b: https://github.com/openmc-dev/openmc/commit/3bd35b
.. _0069d5: https://github.com/openmc-dev/openmc/commit/0069d5
.. _7af2cf: https://github.com/openmc-dev/openmc/commit/7af2cf
.. _460ef1: https://github.com/openmc-dev/openmc/commit/460ef1
.. _85a60e: https://github.com/openmc-dev/openmc/commit/85a60e
.. _3212f5: https://github.com/openmc-dev/openmc/commit/3212f5

View file

@ -36,8 +36,8 @@ Bug Fixes
- 7fd617_: Fixed bug with restart runs in parallel.
- dc4a8f_: Fixed bug with fixed source restart runs.
.. _4654ee: https://github.com/mit-crpg/openmc/commit/4654ee
.. _7ee461: https://github.com/mit-crpg/openmc/commit/7ee461
.. _792eb3: https://github.com/mit-crpg/openmc/commit/792eb3
.. _7fd617: https://github.com/mit-crpg/openmc/commit/7fd617
.. _dc4a8f: https://github.com/mit-crpg/openmc/commit/dc4a8f
.. _4654ee: https://github.com/openmc-dev/openmc/commit/4654ee
.. _7ee461: https://github.com/openmc-dev/openmc/commit/7ee461
.. _792eb3: https://github.com/openmc-dev/openmc/commit/792eb3
.. _7fd617: https://github.com/openmc-dev/openmc/commit/7fd617
.. _dc4a8f: https://github.com/openmc-dev/openmc/commit/dc4a8f

View file

@ -39,11 +39,11 @@ Bug Fixes
- 6f8d9d_: Set default tally labels.
- 6a3a5e_: Fix problem with corner-crossing in lattices.
.. _737b90: https://github.com/mit-crpg/openmc/commit/737b90
.. _a819b4: https://github.com/mit-crpg/openmc/commit/a819b4
.. _b11696: https://github.com/mit-crpg/openmc/commit/b11696
.. _2bd46a: https://github.com/mit-crpg/openmc/commit/2bd46a
.. _7a1f08: https://github.com/mit-crpg/openmc/commit/7a1f08
.. _c0e3ec: https://github.com/mit-crpg/openmc/commit/c0e3ec
.. _6f8d9d: https://github.com/mit-crpg/openmc/commit/6f8d9d
.. _6a3a5e: https://github.com/mit-crpg/openmc/commit/6a3a5e
.. _737b90: https://github.com/openmc-dev/openmc/commit/737b90
.. _a819b4: https://github.com/openmc-dev/openmc/commit/a819b4
.. _b11696: https://github.com/openmc-dev/openmc/commit/b11696
.. _2bd46a: https://github.com/openmc-dev/openmc/commit/2bd46a
.. _7a1f08: https://github.com/openmc-dev/openmc/commit/7a1f08
.. _c0e3ec: https://github.com/openmc-dev/openmc/commit/c0e3ec
.. _6f8d9d: https://github.com/openmc-dev/openmc/commit/6f8d9d
.. _6a3a5e: https://github.com/openmc-dev/openmc/commit/6a3a5e

View file

@ -36,8 +36,8 @@ Bug Fixes
- 63bfd2_: Fix tracklength tallies with cell filter and universes.
- 88daf7_: Fix analog tallies with survival biasing.
.. _94103e: https://github.com/mit-crpg/openmc/commit/94103e
.. _e77059: https://github.com/mit-crpg/openmc/commit/e77059
.. _b0fe88: https://github.com/mit-crpg/openmc/commit/b0fe88
.. _63bfd2: https://github.com/mit-crpg/openmc/commit/63bfd2
.. _88daf7: https://github.com/mit-crpg/openmc/commit/88daf7
.. _94103e: https://github.com/openmc-dev/openmc/commit/94103e
.. _e77059: https://github.com/openmc-dev/openmc/commit/e77059
.. _b0fe88: https://github.com/openmc-dev/openmc/commit/b0fe88
.. _63bfd2: https://github.com/openmc-dev/openmc/commit/63bfd2
.. _88daf7: https://github.com/openmc-dev/openmc/commit/88daf7

View file

@ -41,15 +41,15 @@ Bug Fixes
- ab0793_: Corrected PETSC_NULL references to their correct types.
- 182ebd_: Use analog estimator with energyout filter.
.. _7632f3: https://github.com/mit-crpg/openmc/commit/7632f3
.. _f85ac4: https://github.com/mit-crpg/openmc/commit/f85ac4
.. _49c36b: https://github.com/mit-crpg/openmc/commit/49c36b
.. _5ccc78: https://github.com/mit-crpg/openmc/commit/5ccc78
.. _b1f52f: https://github.com/mit-crpg/openmc/commit/b1f52f
.. _eae7e5: https://github.com/mit-crpg/openmc/commit/eae7e5
.. _10c1cc: https://github.com/mit-crpg/openmc/commit/10c1cc
.. _afdb50: https://github.com/mit-crpg/openmc/commit/afdb50
.. _a3c593: https://github.com/mit-crpg/openmc/commit/a3c593
.. _3a66e3: https://github.com/mit-crpg/openmc/commit/3a66e3
.. _ab0793: https://github.com/mit-crpg/openmc/commit/ab0793
.. _182ebd: https://github.com/mit-crpg/openmc/commit/182ebd
.. _7632f3: https://github.com/openmc-dev/openmc/commit/7632f3
.. _f85ac4: https://github.com/openmc-dev/openmc/commit/f85ac4
.. _49c36b: https://github.com/openmc-dev/openmc/commit/49c36b
.. _5ccc78: https://github.com/openmc-dev/openmc/commit/5ccc78
.. _b1f52f: https://github.com/openmc-dev/openmc/commit/b1f52f
.. _eae7e5: https://github.com/openmc-dev/openmc/commit/eae7e5
.. _10c1cc: https://github.com/openmc-dev/openmc/commit/10c1cc
.. _afdb50: https://github.com/openmc-dev/openmc/commit/afdb50
.. _a3c593: https://github.com/openmc-dev/openmc/commit/a3c593
.. _3a66e3: https://github.com/openmc-dev/openmc/commit/3a66e3
.. _ab0793: https://github.com/openmc-dev/openmc/commit/ab0793
.. _182ebd: https://github.com/openmc-dev/openmc/commit/182ebd

View file

@ -40,8 +40,8 @@ Bug Fixes
- c18a6e_: Check for valid secondary mode on S(a,b) tables.
- 82c456_: Fix bug where last process could have zero particles.
.. _2b1e8a: https://github.com/mit-crpg/openmc/commit/2b1e8a
.. _5853d2: https://github.com/mit-crpg/openmc/commit/5853d2
.. _e178c7: https://github.com/mit-crpg/openmc/commit/e178c7
.. _c18a6e: https://github.com/mit-crpg/openmc/commit/c18a6e
.. _82c456: https://github.com/mit-crpg/openmc/commit/82c456
.. _2b1e8a: https://github.com/openmc-dev/openmc/commit/2b1e8a
.. _5853d2: https://github.com/openmc-dev/openmc/commit/5853d2
.. _e178c7: https://github.com/openmc-dev/openmc/commit/e178c7
.. _c18a6e: https://github.com/openmc-dev/openmc/commit/c18a6e
.. _82c456: https://github.com/openmc-dev/openmc/commit/82c456

View file

@ -39,13 +39,13 @@ Bug Fixes
- cf567c_: ENDF/B-VI data checked for compatibility
- 6b9461_: Fix p_valid sampling inside of sample_energy
.. _32c03c: https://github.com/mit-crpg/openmc/commit/32c03c
.. _c71ef5: https://github.com/mit-crpg/openmc/commit/c71ef5
.. _8884fb: https://github.com/mit-crpg/openmc/commit/8884fb
.. _b38af0: https://github.com/mit-crpg/openmc/commit/b38af0
.. _d28750: https://github.com/mit-crpg/openmc/commit/d28750
.. _cf567c: https://github.com/mit-crpg/openmc/commit/cf567c
.. _6b9461: https://github.com/mit-crpg/openmc/commit/6b9461
.. _32c03c: https://github.com/openmc-dev/openmc/commit/32c03c
.. _c71ef5: https://github.com/openmc-dev/openmc/commit/c71ef5
.. _8884fb: https://github.com/openmc-dev/openmc/commit/8884fb
.. _b38af0: https://github.com/openmc-dev/openmc/commit/b38af0
.. _d28750: https://github.com/openmc-dev/openmc/commit/d28750
.. _cf567c: https://github.com/openmc-dev/openmc/commit/cf567c
.. _6b9461: https://github.com/openmc-dev/openmc/commit/6b9461
------------
Contributors

View file

@ -35,13 +35,13 @@ Bug Fixes
- d7a7d0_: Fix bug with <element> specifying xs attribute
- 85b3cb_: Fix out-of-bounds error with OpenMP threading
.. _41f7ca: https://github.com/mit-crpg/openmc/commit/41f7ca
.. _038736: https://github.com/mit-crpg/openmc/commit/038736
.. _46f9e8: https://github.com/mit-crpg/openmc/commit/46f9e8
.. _d1ca35: https://github.com/mit-crpg/openmc/commit/d1ca35
.. _0291c0: https://github.com/mit-crpg/openmc/commit/0291c0
.. _d7a7d0: https://github.com/mit-crpg/openmc/commit/d7a7d0
.. _85b3cb: https://github.com/mit-crpg/openmc/commit/85b3cb
.. _41f7ca: https://github.com/openmc-dev/openmc/commit/41f7ca
.. _038736: https://github.com/openmc-dev/openmc/commit/038736
.. _46f9e8: https://github.com/openmc-dev/openmc/commit/46f9e8
.. _d1ca35: https://github.com/openmc-dev/openmc/commit/d1ca35
.. _0291c0: https://github.com/openmc-dev/openmc/commit/0291c0
.. _d7a7d0: https://github.com/openmc-dev/openmc/commit/d7a7d0
.. _85b3cb: https://github.com/openmc-dev/openmc/commit/85b3cb
------------
Contributors

View file

@ -38,16 +38,16 @@ Bug Fixes
- 2a95ef_: Prevent segmentation fault on "current" score without mesh filter
- 93e482_: Check for negative values in probability tables
.. _03e890: https://github.com/mit-crpg/openmc/commit/03e890
.. _4439de: https://github.com/mit-crpg/openmc/commit/4439de
.. _5808ed: https://github.com/mit-crpg/openmc/commit/5808ed
.. _2e60c0: https://github.com/mit-crpg/openmc/commit/2e60c0
.. _3e0870: https://github.com/mit-crpg/openmc/commit/3e0870
.. _dc4776: https://github.com/mit-crpg/openmc/commit/dc4776
.. _01178b: https://github.com/mit-crpg/openmc/commit/01178b
.. _62ec43: https://github.com/mit-crpg/openmc/commit/62ec43
.. _2a95ef: https://github.com/mit-crpg/openmc/commit/2a95ef
.. _93e482: https://github.com/mit-crpg/openmc/commit/93e482
.. _03e890: https://github.com/openmc-dev/openmc/commit/03e890
.. _4439de: https://github.com/openmc-dev/openmc/commit/4439de
.. _5808ed: https://github.com/openmc-dev/openmc/commit/5808ed
.. _2e60c0: https://github.com/openmc-dev/openmc/commit/2e60c0
.. _3e0870: https://github.com/openmc-dev/openmc/commit/3e0870
.. _dc4776: https://github.com/openmc-dev/openmc/commit/dc4776
.. _01178b: https://github.com/openmc-dev/openmc/commit/01178b
.. _62ec43: https://github.com/openmc-dev/openmc/commit/62ec43
.. _2a95ef: https://github.com/openmc-dev/openmc/commit/2a95ef
.. _93e482: https://github.com/openmc-dev/openmc/commit/93e482
------------
Contributors

View file

@ -33,10 +33,10 @@ Bug Fixes
- e6abb9_: Fix segfault when tallying in a void material
- 291b45_: Handle metastable nuclides in NNDC data and multiplicities in MT=5 data
.. _26fb93: https://github.com/mit-crpg/openmc/commit/26fb93
.. _2f07c0: https://github.com/mit-crpg/openmc/commit/2f07c0
.. _e6abb9: https://github.com/mit-crpg/openmc/commit/e6abb9
.. _291b45: https://github.com/mit-crpg/openmc/commit/291b45
.. _26fb93: https://github.com/openmc-dev/openmc/commit/26fb93
.. _2f07c0: https://github.com/openmc-dev/openmc/commit/2f07c0
.. _e6abb9: https://github.com/openmc-dev/openmc/commit/e6abb9
.. _291b45: https://github.com/openmc-dev/openmc/commit/291b45
------------
Contributors

View file

@ -40,11 +40,11 @@ Bug Fixes
- 6121d9_: Fix bugs related to particle track files
- 2f0e89_: Fixes for nuclide specification in tallies
.. _b5f712: https://github.com/mit-crpg/openmc/commit/b5f712
.. _e6675b: https://github.com/mit-crpg/openmc/commit/e6675b
.. _04e2c1: https://github.com/mit-crpg/openmc/commit/04e2c1
.. _6121d9: https://github.com/mit-crpg/openmc/commit/6121d9
.. _2f0e89: https://github.com/mit-crpg/openmc/commit/2f0e89
.. _b5f712: https://github.com/openmc-dev/openmc/commit/b5f712
.. _e6675b: https://github.com/openmc-dev/openmc/commit/e6675b
.. _04e2c1: https://github.com/openmc-dev/openmc/commit/04e2c1
.. _6121d9: https://github.com/openmc-dev/openmc/commit/6121d9
.. _2f0e89: https://github.com/openmc-dev/openmc/commit/2f0e89
------------
Contributors

View file

@ -62,15 +62,15 @@ Bug Fixes
- 441fd4_: Fix bug in kappa-fission score
- 7e5974_: Allow fixed source simulations from Python API
.. _299322: https://github.com/mit-crpg/openmc/commit/299322
.. _d74840: https://github.com/mit-crpg/openmc/commit/d74840
.. _c29a81: https://github.com/mit-crpg/openmc/commit/c29a81
.. _3edc23: https://github.com/mit-crpg/openmc/commit/3edc23
.. _629e3b: https://github.com/mit-crpg/openmc/commit/629e3b
.. _5dbe8b: https://github.com/mit-crpg/openmc/commit/5dbe8b
.. _ff66f4: https://github.com/mit-crpg/openmc/commit/ff66f4
.. _441fd4: https://github.com/mit-crpg/openmc/commit/441fd4
.. _7e5974: https://github.com/mit-crpg/openmc/commit/7e5974
.. _299322: https://github.com/openmc-dev/openmc/commit/299322
.. _d74840: https://github.com/openmc-dev/openmc/commit/d74840
.. _c29a81: https://github.com/openmc-dev/openmc/commit/c29a81
.. _3edc23: https://github.com/openmc-dev/openmc/commit/3edc23
.. _629e3b: https://github.com/openmc-dev/openmc/commit/629e3b
.. _5dbe8b: https://github.com/openmc-dev/openmc/commit/5dbe8b
.. _ff66f4: https://github.com/openmc-dev/openmc/commit/ff66f4
.. _441fd4: https://github.com/openmc-dev/openmc/commit/441fd4
.. _7e5974: https://github.com/openmc-dev/openmc/commit/7e5974
------------
Contributors

View file

@ -65,17 +65,17 @@ Bug Fixes
- 8467ae_: Better threshold for allowable lost particles
- 493c6f_: Fix type of return argument for h5pget_driver_f
.. _70daa7: https://github.com/mit-crpg/openmc/commit/70daa7
.. _40b05f: https://github.com/mit-crpg/openmc/commit/40b05f
.. _9586ed: https://github.com/mit-crpg/openmc/commit/9586ed
.. _a855e8: https://github.com/mit-crpg/openmc/commit/a855e8
.. _7294a1: https://github.com/mit-crpg/openmc/commit/7294a1
.. _12f246: https://github.com/mit-crpg/openmc/commit/12f246
.. _0227f4: https://github.com/mit-crpg/openmc/commit/0227f4
.. _51deaa: https://github.com/mit-crpg/openmc/commit/51deaa
.. _fed74b: https://github.com/mit-crpg/openmc/commit/fed74b
.. _8467ae: https://github.com/mit-crpg/openmc/commit/8467ae
.. _493c6f: https://github.com/mit-crpg/openmc/commit/493c6f
.. _70daa7: https://github.com/openmc-dev/openmc/commit/70daa7
.. _40b05f: https://github.com/openmc-dev/openmc/commit/40b05f
.. _9586ed: https://github.com/openmc-dev/openmc/commit/9586ed
.. _a855e8: https://github.com/openmc-dev/openmc/commit/a855e8
.. _7294a1: https://github.com/openmc-dev/openmc/commit/7294a1
.. _12f246: https://github.com/openmc-dev/openmc/commit/12f246
.. _0227f4: https://github.com/openmc-dev/openmc/commit/0227f4
.. _51deaa: https://github.com/openmc-dev/openmc/commit/51deaa
.. _fed74b: https://github.com/openmc-dev/openmc/commit/fed74b
.. _8467ae: https://github.com/openmc-dev/openmc/commit/8467ae
.. _493c6f: https://github.com/openmc-dev/openmc/commit/493c6f
------------
Contributors

View file

@ -111,25 +111,25 @@ Bug Fixes
- 489540_: Check for void materials in tracklength tallies
- f0214f_: Fixes/improvements to the ARES algorithm
.. _c5df6c: https://github.com/mit-crpg/openmc/commit/c5df6c
.. _1cfa39: https://github.com/mit-crpg/openmc/commit/1cfa39
.. _335359: https://github.com/mit-crpg/openmc/commit/335359
.. _17c678: https://github.com/mit-crpg/openmc/commit/17c678
.. _23ec0b: https://github.com/mit-crpg/openmc/commit/23ec0b
.. _7eefb7: https://github.com/mit-crpg/openmc/commit/7eefb7
.. _7880d4: https://github.com/mit-crpg/openmc/commit/7880d4
.. _ad2d9f: https://github.com/mit-crpg/openmc/commit/ad2d9f
.. _59fdca: https://github.com/mit-crpg/openmc/commit/59fdca
.. _9eff5b: https://github.com/mit-crpg/openmc/commit/9eff5b
.. _7848a9: https://github.com/mit-crpg/openmc/commit/7848a9
.. _f139ce: https://github.com/mit-crpg/openmc/commit/f139ce
.. _b8ddfa: https://github.com/mit-crpg/openmc/commit/b8ddfa
.. _ec3cfb: https://github.com/mit-crpg/openmc/commit/ec3cfb
.. _5e9b06: https://github.com/mit-crpg/openmc/commit/5e9b06
.. _c39990: https://github.com/mit-crpg/openmc/commit/c39990
.. _c6b67e: https://github.com/mit-crpg/openmc/commit/c6b67e
.. _489540: https://github.com/mit-crpg/openmc/commit/489540
.. _f0214f: https://github.com/mit-crpg/openmc/commit/f0214f
.. _c5df6c: https://github.com/openmc-dev/openmc/commit/c5df6c
.. _1cfa39: https://github.com/openmc-dev/openmc/commit/1cfa39
.. _335359: https://github.com/openmc-dev/openmc/commit/335359
.. _17c678: https://github.com/openmc-dev/openmc/commit/17c678
.. _23ec0b: https://github.com/openmc-dev/openmc/commit/23ec0b
.. _7eefb7: https://github.com/openmc-dev/openmc/commit/7eefb7
.. _7880d4: https://github.com/openmc-dev/openmc/commit/7880d4
.. _ad2d9f: https://github.com/openmc-dev/openmc/commit/ad2d9f
.. _59fdca: https://github.com/openmc-dev/openmc/commit/59fdca
.. _9eff5b: https://github.com/openmc-dev/openmc/commit/9eff5b
.. _7848a9: https://github.com/openmc-dev/openmc/commit/7848a9
.. _f139ce: https://github.com/openmc-dev/openmc/commit/f139ce
.. _b8ddfa: https://github.com/openmc-dev/openmc/commit/b8ddfa
.. _ec3cfb: https://github.com/openmc-dev/openmc/commit/ec3cfb
.. _5e9b06: https://github.com/openmc-dev/openmc/commit/5e9b06
.. _c39990: https://github.com/openmc-dev/openmc/commit/c39990
.. _c6b67e: https://github.com/openmc-dev/openmc/commit/c6b67e
.. _489540: https://github.com/openmc-dev/openmc/commit/489540
.. _f0214f: https://github.com/openmc-dev/openmc/commit/f0214f
------------
Contributors

View file

@ -141,13 +141,13 @@ and `Volume II`_. You may also find it helpful to review the following terms:
- `Effective multiplication factor`_
- `Flux`_
.. _nuclear reactor: http://en.wikipedia.org/wiki/Nuclear_reactor
.. _Monte Carlo: http://en.wikipedia.org/wiki/Monte_Carlo_method
.. _fission: http://en.wikipedia.org/wiki/Nuclear_fission
.. _deterministic: http://en.wikipedia.org/wiki/Deterministic_algorithm
.. _neutron transport: http://en.wikipedia.org/wiki/Neutron_transport
.. _discretization: http://en.wikipedia.org/wiki/Discretization
.. _constructive solid geometry: http://en.wikipedia.org/wiki/Constructive_solid_geometry
.. _nuclear reactor: https://en.wikipedia.org/wiki/Nuclear_reactor
.. _Monte Carlo: https://en.wikipedia.org/wiki/Monte_Carlo_method
.. _fission: https://en.wikipedia.org/wiki/Nuclear_fission
.. _deterministic: https://en.wikipedia.org/wiki/Deterministic_algorithm
.. _neutron transport: https://en.wikipedia.org/wiki/Neutron_transport
.. _discretization: https://en.wikipedia.org/wiki/Discretization
.. _constructive solid geometry: https://en.wikipedia.org/wiki/Constructive_solid_geometry
.. _git: http://git-scm.com/
.. _git tutorials: http://git-scm.com/documentation
.. _Reactor Concepts Manual: http://www.tayloredge.com/periodic/trivia/ReactorConcepts.pdf
@ -156,6 +156,6 @@ and `Volume II`_. You may also find it helpful to review the following terms:
.. _OpenMC source code: https://github.com/openmc-dev/openmc
.. _GitHub: https://github.com/
.. _bug reports: https://github.com/openmc-dev/openmc/issues
.. _Neutron cross section: http://en.wikipedia.org/wiki/Neutron_cross_section
.. _Neutron cross section: https://en.wikipedia.org/wiki/Neutron_cross_section
.. _Effective multiplication factor: https://en.wikipedia.org/wiki/Nuclear_chain_reaction#Effective_neutron_multiplication_factor
.. _Flux: http://en.wikipedia.org/wiki/Neutron_flux
.. _Flux: https://en.wikipedia.org/wiki/Neutron_flux

View file

@ -16,10 +16,10 @@ recommended to use one of the pregenerated libraries. Alternatively, if you have
ACE format data that was produced with NJOY_, such as that distributed with
MCNP_ or Serpent_, it can be converted to the HDF5 format using the :ref:`using
the Python API <create_xs_library>`. Several sources provide openly available
ACE data including the `ENDF/B`_, JEFF_, and TENDL_
libraries. In addition to tabulated cross sections in the HDF5 files, OpenMC
relies on :ref:`windowed multipole <windowed_multipole>` data to perform
on-the-fly Doppler broadening.
ACE data including the `ENDF/B`_, JEFF_, and TENDL_ libraries as well as the
`LANL Nuclear Data Team <https://nucleardata.lanl.gov/>`_. In addition to
tabulated cross sections in the HDF5 files, OpenMC relies on :ref:`windowed
multipole <windowed_multipole>` data to perform on-the-fly Doppler broadening.
In multi-group mode, OpenMC utilizes an HDF5-based library format which can be
used to describe nuclide- or material-specific quantities.
@ -30,11 +30,11 @@ Environment Variables
When :ref:`scripts_openmc` is run, it will look for several environment
variables that indicate where cross sections can be found. While the location of
cross sections can also be indicated through the :class:`openmc.Materials` class
(or in the :ref:`materials.xml <io_materials>` file), if you always use the same
set of cross section data, it is often easier to just set an environment
variable that will be picked up by default every time OpenMC is run. The
following environment variables are used:
cross sections can also be indicated through the
:attr:`openmc.Materials.cross_setion` attribute (or in the :ref:`materials.xml
<io_materials>` file), if you always use the same set of cross section data, it
is often easier to just set an environment variable that will be picked up by
default every time OpenMC is run. The following environment variables are used:
:envvar:`OPENMC_CROSS_SECTIONS`
Indicates the path to the :ref:`cross_sections.xml <io_cross_sections>`

View file

@ -29,8 +29,8 @@ operator class requires a :class:`openmc.Geometry` instance and a
op = openmc.deplete.Operator(geom, settings)
:mod:`openmc.deplete` supports multiple time-integration methods for determining
material compositions over time. Each method appears as a different function.
For example, :func:`openmc.deplete.integrator.cecm` runs a depletion calculation
material compositions over time. Each method appears as a different class.
For example, :class:`openmc.deplete.CECMIntegrator` runs a depletion calculation
using the CE/CM algorithm (deplete over a timestep using the middle-of-step
reaction rates). An instance of :class:`openmc.deplete.Operator` is passed to
one of these functions along with the power level and timesteps::
@ -38,7 +38,7 @@ one of these functions along with the power level and timesteps::
power = 1200.0e6
days = 24*60*60
timesteps = [10.0*days, 10.0*days, 10.0*days]
openmc.deplete.cecm(op, power, timesteps)
openmc.deplete.CECMIntegrator(op, power, timesteps).integrate()
The coupled transport-depletion problem is executed, and once it is done a
``depletion_results.h5`` file is written. The results can be analyzed using the
@ -46,8 +46,92 @@ The coupled transport-depletion problem is executed, and once it is done a
easy retrieval of k-effective, nuclide concentrations, and reaction rates over
time::
results = openmc.deplete.ResultsList("depletion_results.h5")
results = openmc.deplete.ResultsList.from_hdf5("depletion_results.h5")
time, keff = results.get_eigenvalue()
Note that the coupling between the transport solver and the transmutation solver
happens in-memory rather than by reading/writing files on disk.
Caveats
=======
Energy Deposition
-----------------
The default energy deposition mode, ``"fission-q"``, instructs the
:class:`openmc.deplete.Operator` to normalize reaction rates using the product
of fission reaction rates and fission Q values taken from the depletion chain.
This approach does not consider indirect contributions to energy deposition,
such as neutron heating and energy from secondary photons. In doing this,
the energy deposited during a transport calculation will be lower than expected.
This causes the reaction rates to be over-adjusted to hit the user-specific power,
or power density, leading to an over-depletion of burnable materials.
There are some remedies. First, the fission Q values can be directly set in a
variety of ways. This requires knowing what the total fission energy release should
be, including indirect components. Some examples are provided below::
# use a dictionary of fission_q values
fission_q = {"U235": 202} # energy in MeV
# create a modified chain and write it to a new file
chain = openmc.deplete.Chain.from_xml("chain.xml", fission_q)
chain.export_to_xml("chain_mod_q.xml")
op = openmc.deplete.Operator(geometry, setting, "chain_mod_q.xml")
# alternatively, pass the modified fission Q directly to the operator
op = openmc.deplete.Operator(geometry, setting, "chain.xml",
fission_q=fission_q)
A more complete way to model the energy deposition is to use the modified heating
reactions described in :ref:`methods_heating`. These values can be used to normalize
reaction rates instead of using the fission reaction rates with::
op = openmc.deplete.Operator(geometry, settings, "chain.xml",
energy_mode="energy-deposition")
These modified heating libraries can be generated by running the latest version
of :meth:`openmc.data.IncidentNeutron.from_njoy`, and will eventually be bundled into
the distributed libraries.
Local Spectra and Repeated Materials
------------------------------------
It is not uncommon to explicitly create a single burnable material across many locations.
From a pure transport perspective, there is nothing wrong with creating a single
3.5 wt.% enriched fuel ``fuel_3``, and placing that fuel in every fuel pin in an assembly
or even full core problem. This certainly expedites the model making process, but can pose
issues with depletion.
Under this setup, :mod:`openmc.deplete` will deplete a single ``fuel_3`` material using
a single set of reaction rates, and produce a single new composition for the next time
step. This can be problematic if the same ``fuel_3`` is used in very different regions
of the problem.
As an example, consider a full-scale power reactor core with vacuum boundary
conditions, and with fuel pins solely composed of the same ``fuel_3`` material.
The fuel pins towards the center of the problem will surely experience a more intense
neutron flux and greater reaction rates than those towards the edge of the domain.
This indicates that the fuel in the center should be at a more depleted state than
periphery pins, at least for the fist depletion step.
However, without any other instructions, OpenMC will deplete ``fuel_3`` as a single
material, and all of the fuel pins will have an identical composition at the next
transport step.
This can be countered by instructing the operator to treat repeated instances
of the same material as a unique material definition with::
op = openmc.deplete.Operator(geometry, settings, chain_file,
diff_burnable_mats=True)
For our example problem, this would deplete fuel on the outer region of the problem
with different reaction rates than those in the center. Materials will be depleted
corresponding to their local neutron spectra, and have unique compositions at each
transport step.
.. note::
This will increase the total memory usage and run time due to an increased
number of tallies and material definitions.

View file

@ -121,11 +121,11 @@ For many regions, a bounding-box can be determined automatically::
While a bounding box can be determined for regions involving half-spaces of
spheres, cylinders, and axis-aligned planes, it generally cannot be determined
if the region involves cones, non-axis-aligned planes, or other exotic
second-order surfaces. For example, the :func:`openmc.get_hexagonal_prism`
second-order surfaces. For example, the :func:`openmc.model.hexagonal_prism`
function returns the interior region of a hexagonal prism; because it is bounded
by a :class:`openmc.Plane`, trying to get its bounding box won't work::
>>> hex = openmc.get_hexagonal_prism()
>>> hex = openmc.model.hexagonal_prism()
>>> hex.bounding_box
(array([-0.8660254, -inf, -inf]),
array([ 0.8660254, inf, inf]))
@ -374,7 +374,7 @@ code would work::
hexlat.universes = [outer_ring, middle_ring, inner_ring]
If you need to create a hexagonal boundary (composed of six planar surfaces) for
a hexagonal lattice, :func:`openmc.get_hexagonal_prism` can be used.
a hexagonal lattice, :func:`openmc.model.hexagonal_prism` can be used.
.. _usersguide_geom_export:
@ -396,8 +396,15 @@ if needed, lattices, the last step is to create an instance of
geom.root_universe = root_univ
geom.export_to_xml()
.. _constructive solid geometry: http://en.wikipedia.org/wiki/Constructive_solid_geometry
.. _quadratic surfaces: http://en.wikipedia.org/wiki/Quadric
Note that it's not strictly required to manually create a root universe. You can
also pass a list of cells to the :class:`openmc.Geometry` constructor and it
will handle creating the unverse::
geom = openmc.Geometry([cell1, cell2, cell3])
geom.export_to_xml()
.. _constructive solid geometry: https://en.wikipedia.org/wiki/Constructive_solid_geometry
.. _quadratic surfaces: https://en.wikipedia.org/wiki/Quadric
--------------------------
Using CAD-based Geometry

View file

@ -17,7 +17,8 @@ system for installing multiple versions of software packages and their
dependencies and switching easily between them. `conda-forge
<https://conda-forge.github.io/>`_ is a community-led conda channel of
installable packages. For instructions on installing conda, please consult their
`documentation <http://conda.pydata.org/docs/install/quick.html>`_.
`documentation
<https://docs.conda.io/projects/conda/en/latest/user-guide/install/>`_.
Once you have `conda` installed on your system, add the `conda-forge` channel to
your configuration with:
@ -444,7 +445,7 @@ as for OpenMC.
.. admonition:: Optional
:class: note
`mpi4py <http://mpi4py.scipy.org/>`_
`mpi4py <https://mpi4py.readthedocs.io/en/stable/>`_
mpi4py provides Python bindings to MPI for running distributed-memory
parallel runs. This package is needed if you plan on running depletion
simulations in parallel using MPI.
@ -483,9 +484,9 @@ Make sure to replace the last string on the second line with the path to the
schemas.xml file in your own OpenMC source directory.
.. _GNU Emacs: http://www.gnu.org/software/emacs/
.. _validation: http://en.wikipedia.org/wiki/XML_validation
.. _validation: https://en.wikipedia.org/wiki/XML_validation
.. _RELAX NG: http://relaxng.org/
.. _NNDC: http://www.nndc.bnl.gov/endf/b7.1/acefiles.html
.. _ctest: http://www.cmake.org/cmake/help/v2.8.12/ctest.html
.. _Conda: https://conda.io/docs/
.. _Conda: https://docs.conda.io/en/latest/
.. _pip: https://pip.pypa.io/en/stable/

View file

@ -66,7 +66,7 @@ particular cells/materials should be given colors of your choosing::
}
Note that colors can be given as RGB tuples or by a string indicating a valid
`SVG color <https://www.w3.org/TR/SVG/types.html#ColorKeywords>`_.
`SVG color <https://www.w3.org/TR/SVG11/types.html#ColorKeywords>`_.
When you're done creating your :class:`openmc.Plot` instances, you need to then
assign them to a :class:`openmc.Plots` collection and export it to XML::

View file

@ -221,26 +221,11 @@ selected::
settings.electron_treatment = 'led'
.. warning::
Currently, collision stopping powers used in the TTB approximation come from
the `NIST ESTAR database`_, which provides data for each element calculated
using by default the material density at standard temperature and pressure.
In OpenMC, stopping powers for compounds are calculated from this elemental
data using Bragg's additivity rule. However, this is not a good
approximation --- the collision stopping power is a function of certain
quantities, such as the mean excitation energy and particularly the density
effect correction, that depend on material properties. Data for constituent
elements in a compound cannot simply be summed together, but rather these
quantities should be calculated for the material. This treatment will be
especially poor when the density of a material is different from the
densities used in the NIST data.
.. note::
Some features related to photon transport are not currently implemented,
including:
* Tallying photon energy deposition.
* Properly accounting for energy deposition in coupled n-p calculations.
* Generating a photon source from a neutron calculation that can be used
for a later fixed source photon calculation.
* Photoneutron reactions.

View file

@ -261,7 +261,13 @@ The following tables show all valid scores:
| |produced by NJOY's HEATR module while for photons, |
| |this is tallied from either direct photon energy |
| |deposition (analog estimator) or pre-generated |
| |photon heating number. |
| |photon heating number. See :ref:`methods_heating` |
+----------------------+---------------------------------------------------+
|heating-local |Total nuclear heating in units of eV per source |
| |particle assuming energy from secondary photons is |
| |deposited locally. Note that this score should only|
| |be used for incident neutrons. See |
| |:ref:`methods_heating`. |
+----------------------+---------------------------------------------------+
|kappa-fission |The recoverable energy production rate due to |
| |fission. The recoverable energy is defined as the |

View file

@ -37,6 +37,16 @@ arguments are not necessary. For example,
Of course, the volumes that you *need* this capability for are often the ones
with complex definitions.
A threshold can be applied for the calculation's variance, standard deviation,
or relative error of volume estimates using :meth:`openmc.VolumeCalculation.set_trigger`::
vol_calc.set_trigger(1e-05, 'std_dev')
If a threshold is provided, calculations will be performed iteratively using the
number of samples specified on the calculation until all volume uncertainties are below
the threshold value. If no threshold is provided, the calculation will run the number of
samples specified once and return the result.
Once you have one or more :class:`openmc.VolumeCalculation` objects created, you
can then assign then to :attr:`Settings.volume_calculations`::

View file

@ -0,0 +1 @@
/home/romano/openmc/tests/chain_simple.xml

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -61,14 +61,15 @@ op = openmc.deplete.Operator(geometry, settings_file, chain_file,
previous_results)
# Perform simulation using the predictor algorithm
openmc.deplete.integrator.predictor(op, time_steps, power)
integrator = openmc.deplete.PredictorIntegrator(op, time_steps, power)
integrator.integrate()
###############################################################################
# Read depletion calculation results
###############################################################################
# Open results file
results = openmc.deplete.ResultsList("depletion_results.h5")
results = openmc.deplete.ResultsList.from_hdf5("depletion_results.h5")
# Obtain K_eff as a function of time
time, keff = results.get_eigenvalue()

View file

@ -132,14 +132,15 @@ settings_file.entropy_mesh = entropy_mesh
op = openmc.deplete.Operator(geometry, settings_file, chain_file)
# Perform simulation using the predictor algorithm
openmc.deplete.integrator.predictor(op, time_steps, power)
integrator = openmc.deplete.PredictorIntegrator(op, time_steps, power)
integrator.integrate()
###############################################################################
# Read depletion calculation results
###############################################################################
# Open results file
results = openmc.deplete.ResultsList("depletion_results.h5")
results = openmc.deplete.ResultsList.from_hdf5("depletion_results.h5")
# Obtain K_eff as a function of time
time, keff = results.get_eigenvalue()

View file

@ -110,6 +110,7 @@ extern "C" {
int openmc_tally_get_nuclides(int32_t index, int** nuclides, int* n);
int openmc_tally_get_scores(int32_t index, int** scores, int* n);
int openmc_tally_get_type(int32_t index, int32_t* type);
int openmc_tally_get_writable(int32_t index, bool* writable);
int openmc_tally_reset(int32_t index);
int openmc_tally_results(int32_t index, double** ptr, size_t shape_[3]);
int openmc_tally_set_active(int32_t index, bool active);
@ -119,6 +120,7 @@ extern "C" {
int openmc_tally_set_nuclides(int32_t index, int n, const char** nuclides);
int openmc_tally_set_scores(int32_t index, int n, const char** scores);
int openmc_tally_set_type(int32_t index, const char* type);
int openmc_tally_set_writable(int32_t index, bool writable);
int openmc_zernike_filter_get_order(int32_t index, int* order);
int openmc_zernike_filter_get_params(int32_t index, double* x, double* y, double* r);
int openmc_zernike_filter_set_order(int32_t index, int order);

View file

@ -179,10 +179,10 @@ public:
//! \brief Rotational tranfsormation of the filled universe.
//
//! The vector is empty if there is no rotation. Otherwise, the first three
//! values are the rotation angles respectively about the x-, y-, and z-, axes
//! in degrees. The next 9 values give the rotation matrix in row-major
//! order.
//! The vector is empty if there is no rotation. Otherwise, the first 9 values
//! give the rotation matrix in row-major order. When the user specifies
//! rotation angles about the x-, y- and z- axes in degrees, these values are
//! also present at the end of the vector, making it of length 12.
std::vector<double> rotation_;
std::vector<int32_t> offset_; //!< Distribcell offset table
@ -212,7 +212,26 @@ protected:
bool contains_complex(Position r, Direction u, int32_t on_surface) const;
BoundingBox bounding_box_simple() const;
static BoundingBox bounding_box_complex(std::vector<int32_t> rpn);
static void apply_demorgan(std::vector<int32_t>& rpn);
//! Applies DeMorgan's laws to a section of the RPN
//! \param start Starting point for token modification
//! \param stop Stopping point for token modification
static void apply_demorgan(std::vector<int32_t>::iterator start,
std::vector<int32_t>::iterator stop);
//! Removes complement operators from the RPN
//! \param rpn The rpn to remove complement operators from.
static void remove_complement_ops(std::vector<int32_t>& rpn);
//! Returns the beginning position of a parenthesis block (immediately before
//! two surface tokens) in the RPN given a starting position at the end of
//! that block (immediately after two surface tokens)
//! \param start Starting position of the search
//! \param rpn The rpn being searched
static std::vector<int32_t>::iterator
find_left_parenthesis(std::vector<int32_t>::iterator start,
const std::vector<int32_t>& rpn);
};
//==============================================================================

View file

@ -20,7 +20,7 @@ using double_4dvec = std::vector<std::vector<std::vector<std::vector<double>>>>;
// OpenMC major, minor, and release numbers
constexpr int VERSION_MAJOR {0};
constexpr int VERSION_MINOR {11};
constexpr int VERSION_MINOR {12};
constexpr int VERSION_RELEASE {0};
constexpr bool VERSION_DEV {true};
constexpr std::array<int, 3> VERSION {VERSION_MAJOR, VERSION_MINOR, VERSION_RELEASE};
@ -232,7 +232,7 @@ constexpr int N_XD {204};
constexpr int N_XT {205};
constexpr int N_X3HE {206};
constexpr int N_XA {207};
constexpr int NEUTRON_HEATING {301};
constexpr int HEATING {301};
constexpr int DAMAGE_ENERGY {444};
constexpr int COHERENT {502};
constexpr int INCOHERENT {504};
@ -252,6 +252,7 @@ constexpr int N_A0 {800};
constexpr int N_AC {849};
constexpr int N_2N0 {875};
constexpr int N_2NC {891};
constexpr int HEATING_LOCAL {901};
constexpr std::array<int, 6> DEPLETION_RX {N_GAMMA, N_P, N_A, N_2N, N_3N, N_4N};
@ -369,7 +370,6 @@ constexpr int SCORE_INVERSE_VELOCITY {-13}; // flux-weighted inverse velocity
constexpr int SCORE_FISS_Q_PROMPT {-14}; // prompt fission Q-value
constexpr int SCORE_FISS_Q_RECOV {-15}; // recoverable fission Q-value
constexpr int SCORE_DECAY_RATE {-16}; // delayed neutron precursor decay rate
constexpr int SCORE_HEATING {-17}; // nuclear heating (neutron or photon)
// Tally map bin finding
constexpr int NO_BIN_FOUND {-1};

View file

@ -132,7 +132,7 @@ public:
//----------------------------------------------------------------------------
// Data
int32_t id_; //!< Unique ID
int32_t id_ {-1}; //!< Unique ID
std::string name_; //!< Name of material
std::vector<int> nuclide_; //!< Indices in nuclides vector
std::vector<int> element_; //!< Indices in elements vector

View file

@ -33,9 +33,10 @@ extern std::unordered_map<int32_t, int32_t> mesh_map;
class Mesh
{
public:
// Constructors
// Constructors and destructor
Mesh() = default;
Mesh(pugi::xml_node node);
virtual ~Mesh() = default;
// Methods

View file

@ -93,7 +93,7 @@ public:
std::vector<UrrData> urr_data_;
std::vector<std::unique_ptr<Reaction>> reactions_; //!< Reactions
std::array<size_t, 892> reaction_index_; //!< Index of each reaction
std::array<size_t, 902> reaction_index_; //!< Index of each reaction
std::vector<int> index_inelastic_scatter_;
private:

View file

@ -25,6 +25,7 @@ extern "C" const int BC_TRANSMIT;
extern "C" const int BC_VACUUM;
extern "C" const int BC_REFLECT;
extern "C" const int BC_PERIODIC;
extern "C" const int BC_WHITE;
//==============================================================================
// Global variables
@ -115,6 +116,8 @@ public:
//! \return Outgoing direction of the ray
virtual Direction reflect(Position r, Direction u) const;
virtual Direction diffuse_reflect(Position r, Direction u) const;
//! Evaluate the equation describing the surface.
//!
//! Surfaces can be described by some function f(x, y, z) = 0. This member

View file

@ -37,6 +37,8 @@ public:
void set_active(bool active) { active_ = active; }
void set_writable(bool writable) { writable_ = writable; }
void set_scores(pugi::xml_node node);
void set_scores(const std::vector<std::string>& scores);
@ -55,6 +57,8 @@ public:
int32_t n_filter_bins() const {return n_filter_bins_;}
bool writable() const { return writable_;}
//----------------------------------------------------------------------------
// Other methods.
@ -98,6 +102,9 @@ public:
//! (e.g. specific cell, specific energy group, etc.)
xt::xtensor<double, 3> results_;
//! True if this tally should be written to statepoint files
bool writable_ {true};
//----------------------------------------------------------------------------
// Miscellaneous public members.

View file

@ -76,11 +76,6 @@ private:
std::unique_ptr<AngleEnergy> distribution; //!< Secondary angle-energy distribution
};
//! Upper threshold for incoherent inelastic scattering (usually ~4 eV)
double threshold_inelastic_;
//! Upper threshold for coherent/incoherent elastic scattering
double threshold_elastic_ {0.0};
// Inelastic scattering data
Reaction elastic_;
Reaction inelastic_;

View file

@ -2,12 +2,14 @@
#define OPENMC_VOLUME_CALC_H
#include "openmc/position.h"
#include "openmc/tallies/trigger.h"
#include "pugixml.hpp"
#include "xtensor/xtensor.hpp"
#include <string>
#include <vector>
#include <gsl/gsl>
namespace openmc {
@ -16,6 +18,7 @@ namespace openmc {
//==============================================================================
class VolumeCalculation {
public:
// Aliases, types
struct Result {
@ -23,6 +26,7 @@ public:
std::vector<int> nuclides; //!< Index of nuclides
std::vector<double> atoms; //!< Number of atoms for each nuclide
std::vector<double> uncertainty; //!< Uncertainty on number of atoms
int iterations; //!< Number of iterations needed to obtain the results
}; // Results for a single domain
// Constructors
@ -44,7 +48,9 @@ public:
// Data members
int domain_type_; //!< Type of domain (cell, material, etc.)
int n_samples_; //!< Number of samples to use
size_t n_samples_; //!< Number of samples to use
double threshold_ {-1.0}; //!< Error threshold for domain volumes
TriggerMetric trigger_type_ {TriggerMetric::not_active}; //!< Trigger metric for the volume calculation
Position lower_left_; //!< Lower-left position of bounding box
Position upper_right_; //!< Upper-right position of bounding box
std::vector<int> domain_ids_; //!< IDs of domains to find volumes of

View file

@ -34,4 +34,4 @@ from . import examples
# Import a few convencience functions that used to be here
from openmc.model import rectangular_prism, hexagonal_prism
__version__ = '0.10.0'
__version__ = '0.12.0-dev'

View file

@ -63,6 +63,10 @@ class Cell(IDManagerMixin):
\sin\phi \sin\theta \sin\psi & -\sin\phi \cos\psi + \cos\phi
\sin\theta \sin\psi \\ -\sin\theta & \sin\phi \cos\theta & \cos\phi
\cos\theta \end{array} \right ]
A rotation matrix can also be specified directly by setting this
attribute to a nested list (or 2D numpy array) that specifies each
element of the matrix.
rotation_matrix : numpy.ndarray
The rotation matrix defined by the angles specified in the
:attr:`Cell.rotation` property.
@ -227,21 +231,24 @@ class Cell(IDManagerMixin):
@rotation.setter
def rotation(self, rotation):
cv.check_type('cell rotation', rotation, Iterable, Real)
cv.check_length('cell rotation', rotation, 3)
self._rotation = np.asarray(rotation)
# Save rotation matrix -- the reason we do this instead of having it be
# automatically calculated when the rotation_matrix property is accessed
# is so that plotting on a rotated geometry can be done faster.
phi, theta, psi = self.rotation*(-pi/180.)
c3, s3 = cos(phi), sin(phi)
c2, s2 = cos(theta), sin(theta)
c1, s1 = cos(psi), sin(psi)
self._rotation_matrix = np.array([
[c1*c2, c1*s2*s3 - c3*s1, s1*s3 + c1*c3*s2],
[c2*s1, c1*c3 + s1*s2*s3, c3*s1*s2 - c1*s3],
[-s2, c2*s3, c2*c3]])
if self._rotation.ndim == 2:
# User specified rotation matrix directly
self._rotation_matrix = self._rotation
else:
phi, theta, psi = self.rotation*(-pi/180.)
c3, s3 = cos(phi), sin(phi)
c2, s2 = cos(theta), sin(theta)
c1, s1 = cos(psi), sin(psi)
self._rotation_matrix = np.array([
[c1*c2, c1*s2*s3 - c3*s1, s1*s3 + c1*c3*s2],
[c2*s1, c1*c3 + s1*s2*s3, c3*s1*s2 - c1*s3],
[-s2, c2*s3, c2*c3]])
@translation.setter
def translation(self, translation):
@ -516,7 +523,7 @@ class Cell(IDManagerMixin):
element.set("translation", ' '.join(map(str, self.translation)))
if self.rotation is not None:
element.set("rotation", ' '.join(map(str, self.rotation)))
element.set("rotation", ' '.join(map(str, self.rotation.ravel())))
return element

View file

@ -22,7 +22,7 @@ import numpy as np
from scipy import sparse
import h5py
import openmc.capi
import openmc.lib
from openmc.checkvalue import (check_type, check_length, check_value,
check_greater_than, check_less_than)
from openmc.exceptions import OpenMCError
@ -700,7 +700,7 @@ class CMFDRun(object):
----------
**kwargs
All keyword arguments are passed to
:func:`openmc.capi.run_in_memory`.
:func:`openmc.lib.run_in_memory`.
"""
with self.run_in_memory(**kwargs):
@ -725,7 +725,7 @@ class CMFDRun(object):
Parameters
----------
**kwargs
All keyword arguments passed to :func:`openmc.capi.run_in_memory`.
All keyword arguments passed to :func:`openmc.lib.run_in_memory`.
"""
# Store intracomm for part of CMFD routine where MPI reduce and
@ -736,7 +736,7 @@ class CMFDRun(object):
self._intracomm = MPI.COMM_WORLD
# Run and pass arguments to C API run_in_memory function
with openmc.capi.run_in_memory(**kwargs):
with openmc.lib.run_in_memory(**kwargs):
self.init()
yield
self.finalize()
@ -758,7 +758,7 @@ class CMFDRun(object):
def init(self):
""" Initialize CMFDRun instance by setting up CMFD parameters and
calling :func:`openmc.capi.simulation_init`
calling :func:`openmc.lib.simulation_init`
"""
# Configure CMFD parameters
@ -767,7 +767,7 @@ class CMFDRun(object):
# Create tally objects
self._create_cmfd_tally()
if openmc.capi.master():
if openmc.lib.master():
# Compute and store array indices used to build cross section
# arrays
self._precompute_array_indices()
@ -780,10 +780,10 @@ class CMFDRun(object):
self._initialize_linsolver()
# Initialize simulation
openmc.capi.simulation_init()
openmc.lib.simulation_init()
# Set cmfd_run variable to True through C API
openmc.capi.settings.cmfd_run = True
openmc.lib.settings.cmfd_run = True
def next_batch(self):
""" Run next batch for CMFDRun.
@ -799,26 +799,26 @@ class CMFDRun(object):
self._cmfd_init_batch()
# Run next batch
status = openmc.capi.next_batch()
status = openmc.lib.next_batch()
# Perform CMFD calculations
self._execute_cmfd()
# Write CMFD data to statepoint
if openmc.capi.is_statepoint_batch():
if openmc.lib.is_statepoint_batch():
self.statepoint_write()
return status
def finalize(self):
""" Finalize simulation by calling
:func:`openmc.capi.simulation_finalize` and print out CMFD timing
:func:`openmc.lib.simulation_finalize` and print out CMFD timing
information.
"""
# Finalize simuation
openmc.capi.simulation_finalize()
openmc.lib.simulation_finalize()
if openmc.capi.master():
if openmc.lib.master():
# Print out CMFD timing statistics
self._write_cmfd_timing_stats()
@ -832,13 +832,13 @@ class CMFDRun(object):
"""
if filename is None:
batch_str_len = len(str(openmc.capi.settings.batches))
batch_str = str(openmc.capi.current_batch()).zfill(batch_str_len)
batch_str_len = len(str(openmc.lib.settings.batches))
batch_str = str(openmc.lib.current_batch()).zfill(batch_str_len)
filename = 'statepoint.{}.h5'.format(batch_str)
# Call C API statepoint_write to save source distribution with CMFD
# feedback
openmc.capi.statepoint_write(filename=filename)
openmc.lib.statepoint_write(filename=filename)
# Append CMFD data to statepoint file using h5py
self._write_cmfd_statepoint(filename)
@ -852,10 +852,10 @@ class CMFDRun(object):
Filename of statepoint
"""
if openmc.capi.master():
if openmc.lib.master():
with h5py.File(filename, 'a') as f:
if 'cmfd' not in f:
if openmc.capi.settings.verbosity >= 5:
if openmc.lib.settings.verbosity >= 5:
print(' Writing CMFD data to {}...'.format(filename))
sys.stdout.flush()
cmfd_group = f.create_group("cmfd")
@ -918,7 +918,7 @@ class CMFDRun(object):
args = temp_loss.indptr, len(temp_loss.indptr), \
temp_loss.indices, len(temp_loss.indices), n, \
self._spectral, self._indices, coremap, self._use_all_threads
return openmc.capi._dll.openmc_initialize_linsolver(*args)
return openmc.lib._dll.openmc_initialize_linsolver(*args)
def _write_cmfd_output(self):
"""Write CMFD output to buffer at the end of each batch"""
@ -956,13 +956,13 @@ class CMFDRun(object):
def _configure_cmfd(self):
"""Initialize CMFD parameters and set CMFD input variables"""
# Check if restarting simulation from statepoint file
if not openmc.capi.settings.restart_run:
if not openmc.lib.settings.restart_run:
# Define all variables necessary for running CMFD
self._initialize_cmfd()
else:
# Reset CMFD parameters from statepoint file
path_statepoint = openmc.capi.settings.path_statepoint
path_statepoint = openmc.lib.settings.path_statepoint
self._reset_cmfd(path_statepoint)
def _initialize_cmfd(self):
@ -972,7 +972,7 @@ class CMFDRun(object):
"""
# Print message to user and flush output to stdout
if openmc.capi.settings.verbosity >= 7 and openmc.capi.master():
if openmc.lib.settings.verbosity >= 7 and openmc.lib.master():
print(' Configuring CMFD parameters for simulation')
sys.stdout.flush()
@ -986,7 +986,7 @@ class CMFDRun(object):
self._indices[i] = n
# Check if in continuous energy mode
if not openmc.capi.settings.run_CE:
if not openmc.lib.settings.run_CE:
raise OpenMCError('CMFD must be run in continuous energy mode')
# Set number of energy groups
@ -1004,10 +1004,10 @@ class CMFDRun(object):
if self._mesh.map is not None:
check_length('CMFD coremap', self._mesh.map,
np.product(self._indices[0:3]))
if openmc.capi.master():
if openmc.lib.master():
self._coremap = np.array(self._mesh.map)
else:
if openmc.capi.master():
if openmc.lib.master():
self._coremap = np.ones((np.product(self._indices[0:3])),
dtype=int)
@ -1020,7 +1020,7 @@ class CMFDRun(object):
self._set_tally_window()
# Define all variables that will exist only on master process
if openmc.capi.master():
if openmc.lib.master():
# Set global albedo
if self._mesh.albedo is not None:
self._albedo = np.array(self._mesh.albedo)
@ -1062,8 +1062,8 @@ class CMFDRun(object):
'file {}'.format(filename))
else:
# Overwrite CMFD values from statepoint
if (openmc.capi.master() and
openmc.capi.settings.verbosity >= 5):
if (openmc.lib.master() and
openmc.lib.settings.verbosity >= 5):
print(' Loading CMFD data from {}...'.format(filename))
sys.stdout.flush()
cmfd_group = f['cmfd']
@ -1099,7 +1099,7 @@ class CMFDRun(object):
self._mesh.width = cmfd_mesh['width'][()]
# Define variables that exist only on master process
if openmc.capi.master():
if openmc.lib.master():
self._time_cmfd = cmfd_group.attrs['time_cmfd']
self._time_cmfdbuild = cmfd_group.attrs['time_cmfdbuild']
self._time_cmfdsolve = cmfd_group.attrs['time_cmfdsolve']
@ -1132,7 +1132,7 @@ class CMFDRun(object):
"""Handles CMFD options at the beginning of each batch"""
# Get current batch through C API
# Add 1 as next_batch has not been called yet
current_batch = openmc.capi.current_batch() + 1
current_batch = openmc.lib.current_batch() + 1
# Check to activate CMFD solver and possible feedback
if self._solver_begin == current_batch:
@ -1145,18 +1145,18 @@ class CMFDRun(object):
def _execute_cmfd(self):
"""Runs CMFD calculation on master node"""
if openmc.capi.master():
if openmc.lib.master():
# Start CMFD timer
time_start_cmfd = time.time()
if openmc.capi.current_batch() >= self._tally_begin:
if openmc.lib.current_batch() >= self._tally_begin:
# Calculate all cross sections based on tally window averages
self._compute_xs()
# Execute CMFD algorithm if CMFD on for current batch
if self._cmfd_on:
# Run CMFD on single processor on master
if openmc.capi.master():
if openmc.lib.master():
# Create CMFD data based on OpenMC tallies
self._set_up_cmfd()
@ -1167,7 +1167,7 @@ class CMFDRun(object):
self._k_cmfd.append(self._keff)
# Check to perform adjoint on last batch
if (openmc.capi.current_batch() == openmc.capi.settings.batches
if (openmc.lib.current_batch() == openmc.lib.settings.batches
and self._run_adjoint):
self._cmfd_solver_execute(adjoint=True)
@ -1178,7 +1178,7 @@ class CMFDRun(object):
self._cmfd_reweight()
# Stop CMFD timer
if openmc.capi.master():
if openmc.lib.master():
time_stop_cmfd = time.time()
self._time_cmfd += time_stop_cmfd - time_start_cmfd
if self._cmfd_on:
@ -1189,13 +1189,13 @@ class CMFDRun(object):
def _cmfd_tally_reset(self):
"""Resets all CMFD tallies in memory"""
# Print message
if (openmc.capi.settings.verbosity >= 6 and openmc.capi.master() and
if (openmc.lib.settings.verbosity >= 6 and openmc.lib.master() and
not self._reset_every):
print(' CMFD tallies reset')
sys.stdout.flush()
# Reset CMFD tallies
tallies = openmc.capi.tallies
tallies = openmc.lib.tallies
for tally_id in self._tally_ids:
tallies[tally_id].reset()
@ -1379,7 +1379,7 @@ class CMFDRun(object):
self._cmfd_src = cmfd_src / np.sum(cmfd_src)
# Compute entropy
if openmc.capi.settings.entropy_on:
if openmc.lib.settings.entropy_on:
# Compute source times log_2(source)
source = self._cmfd_src[self._cmfd_src > 0] \
* np.log(self._cmfd_src[self._cmfd_src > 0])/np.log(2)
@ -1403,12 +1403,12 @@ class CMFDRun(object):
outside = self._count_bank_sites()
# Check and raise error if source sites exist outside of CMFD mesh
if openmc.capi.master() and outside:
if openmc.lib.master() and outside:
raise OpenMCError('Source sites outside of the CMFD mesh')
# Have master compute weight factors, ignore any zeros in
# sourcecounts or cmfd_src
if openmc.capi.master():
if openmc.lib.master():
# Compute normalization factor
norm = np.sum(self._sourcecounts) / np.sum(self._cmfd_src)
@ -1440,13 +1440,13 @@ class CMFDRun(object):
self._weightfactors = self._intracomm.bcast(
self._weightfactors)
m = openmc.capi.meshes[self._mesh_id]
m = openmc.lib.meshes[self._mesh_id]
energy = self._egrid
ng = self._indices[3]
# Get locations and energies of all particles in source bank
source_xyz = openmc.capi.source_bank()['r']
source_energies = openmc.capi.source_bank()['E']
source_xyz = openmc.lib.source_bank()['r']
source_energies = openmc.lib.source_bank()['E']
# Convert xyz location to the CMFD mesh index
mesh_ijk = np.floor((source_xyz - m.lower_left)/m.width).astype(int)
@ -1464,13 +1464,13 @@ class CMFDRun(object):
# Determine weight factor of each particle based on its mesh index
# and energy bin and updates its weight
openmc.capi.source_bank()['wgt'] *= self._weightfactors[
openmc.lib.source_bank()['wgt'] *= self._weightfactors[
mesh_ijk[:,0], mesh_ijk[:,1], mesh_ijk[:,2], energy_bins]
if openmc.capi.master() and np.any(source_energies < energy[0]):
if openmc.lib.master() and np.any(source_energies < energy[0]):
print(' WARNING: Source point below energy grid')
sys.stdout.flush()
if openmc.capi.master() and np.any(source_energies > energy[-1]):
if openmc.lib.master() and np.any(source_energies > energy[-1]):
print(' WARNING: Source point above energy grid')
sys.stdout.flush()
@ -1484,8 +1484,8 @@ class CMFDRun(object):
"""
# Initialize variables
m = openmc.capi.meshes[self._mesh_id]
bank = openmc.capi.source_bank()
m = openmc.lib.meshes[self._mesh_id]
bank = openmc.lib.source_bank()
energy = self._egrid
sites_outside = np.zeros(1, dtype=bool)
nxnynz = np.prod(self._indices[0:3])
@ -1496,8 +1496,8 @@ class CMFDRun(object):
count = np.zeros(self._sourcecounts.shape)
# Get location and energy of each particle in source bank
source_xyz = openmc.capi.source_bank()['r']
source_energies = openmc.capi.source_bank()['E']
source_xyz = openmc.lib.source_bank()['r']
source_energies = openmc.lib.source_bank()['E']
# Convert xyz location to mesh index and ravel index to scalar
mesh_locations = np.floor((source_xyz - m.lower_left) / m.width)
@ -1721,7 +1721,7 @@ class CMFDRun(object):
s_o = np.zeros((n,))
# Set initial guess
k_n = openmc.capi.keff()[0]
k_n = openmc.lib.keff()[0]
k_o = k_n
dw = self._w_shift
k_s = k_o + dw
@ -1752,7 +1752,7 @@ class CMFDRun(object):
s_o /= k_lo
# Compute new flux with C++ solver
innerits = openmc.capi._dll.openmc_run_linsolver(loss.data, s_o,
innerits = openmc.lib._dll.openmc_run_linsolver(loss.data, s_o,
phi_n, toli)
# Compute new source vector
@ -1824,7 +1824,7 @@ class CMFDRun(object):
iconv = kerr < self._cmfd_ktol and serr < self._stol
# Print out to user
if self._power_monitor and openmc.capi.master():
if self._power_monitor and openmc.lib.master():
str1 = ' {:d}:'.format(iter)
str2 = 'k-eff: {:0.8f}'.format(k_n)
str3 = 'k-error: {:.5e}'.format(kerr)
@ -1865,7 +1865,7 @@ class CMFDRun(object):
"""
# Update window size for expanding window if necessary
num_cmfd_batches = openmc.capi.current_batch() - self._tally_begin + 1
num_cmfd_batches = openmc.lib.current_batch() - self._tally_begin + 1
if (self._window_type == 'expanding' and
num_cmfd_batches == self._window_size * 2):
self._window_size *= 2
@ -1886,7 +1886,7 @@ class CMFDRun(object):
nx, ny, nz, ng = self._indices
# Get tallies in-memory
tallies = openmc.capi.tallies
tallies = openmc.lib.tallies
# Set conditional numpy array as boolean vector based on coremap
is_accel = self._coremap != _CMFD_NOACCEL
@ -2135,7 +2135,7 @@ class CMFDRun(object):
num_accel = self._mat_dim
# Get openmc k-effective
keff = openmc.capi.keff()[0]
keff = openmc.lib.keff()[0]
# Define leakage in each mesh cell and energy group
leakage = (((self._current[:,:,:,_CURRENTS['out_right'],:] -
@ -2186,7 +2186,7 @@ class CMFDRun(object):
# Allocate dimensions for each mesh cell
self._hxyz = np.zeros((nx, ny, nz, 3))
self._hxyz[:] = openmc.capi.meshes[self._mesh_id].width
self._hxyz[:] = openmc.lib.meshes[self._mesh_id].width
# Allocate flux, cross sections and diffusion coefficient
self._flux = np.zeros((nx, ny, nz, ng))
@ -2953,7 +2953,7 @@ class CMFDRun(object):
def _create_cmfd_tally(self):
"""Creates all tallies in-memory that are used to solve CMFD problem"""
# Create Mesh object based on CMFDMesh, stored internally
cmfd_mesh = openmc.capi.RegularMesh()
cmfd_mesh = openmc.lib.RegularMesh()
# Store id of mesh object
self._mesh_id = cmfd_mesh.id
# Set dimension and parameters of mesh object
@ -2963,29 +2963,29 @@ class CMFDRun(object):
width=self._mesh.width)
# Create mesh Filter object, stored internally
mesh_filter = openmc.capi.MeshFilter()
mesh_filter = openmc.lib.MeshFilter()
# Set mesh for Mesh Filter
mesh_filter.mesh = cmfd_mesh
# Set up energy filters, if applicable
if self._energy_filters:
# Create Energy Filter object, stored internally
energy_filter = openmc.capi.EnergyFilter()
energy_filter = openmc.lib.EnergyFilter()
# Set bins for Energy Filter
energy_filter.bins = self._egrid
# Create Energy Out Filter object, stored internally
energyout_filter = openmc.capi.EnergyoutFilter()
energyout_filter = openmc.lib.EnergyoutFilter()
# Set bins for Energy Filter
energyout_filter.bins = self._egrid
# Create Mesh Surface Filter object, stored internally
meshsurface_filter = openmc.capi.MeshSurfaceFilter()
meshsurface_filter = openmc.lib.MeshSurfaceFilter()
# Set mesh for Mesh Surface Filter
meshsurface_filter.mesh = cmfd_mesh
# Create Legendre Filter object, stored internally
legendre_filter = openmc.capi.LegendreFilter()
legendre_filter = openmc.lib.LegendreFilter()
# Set order for Legendre Filter
legendre_filter.order = 1
@ -2993,7 +2993,7 @@ class CMFDRun(object):
n_tallies = 4
self._tally_ids = []
for i in range(n_tallies):
cmfd_tally = openmc.capi.Tally()
cmfd_tally = openmc.lib.Tally()
# Set nuclide bins
cmfd_tally.nuclides = ['total']
self._tally_ids.append(cmfd_tally.id)

View file

@ -118,7 +118,12 @@ class IncidentNeutron(EqualityMixin):
if mt in self.reactions:
return self.reactions[mt]
else:
raise KeyError('No reaction with MT={}.'.format(mt))
# Try to create a redundant cross section
mts = self.get_reaction_components(mt)
if len(mts) > 0:
return self._get_redundant_reaction(mt, mts)
else:
raise KeyError('No reaction with MT={}.'.format(mt))
def __repr__(self):
return "<IncidentNeutron: {}>".format(self.name)
@ -452,7 +457,7 @@ class IncidentNeutron(EqualityMixin):
if rx.redundant:
photon_rx = any(p.particle == 'photon' for p in rx.products)
keep_mts = (4, 16, 103, 104, 105, 106, 107,
203, 204, 205, 206, 207, 301, 318, 444)
203, 204, 205, 206, 207, 301, 444, 901)
if not (photon_rx or rx.mt in keep_mts):
continue
@ -553,20 +558,6 @@ class IncidentNeutron(EqualityMixin):
fer_group = group['fission_energy_release']
data.fission_energy = FissionEnergyRelease.from_hdf5(fer_group)
# Rebuild non-fission heating
total_heating = data.reactions.get(301)
fission_heating = data.reactions.get(318)
if total_heating is not None and fission_heating is not None:
non_fission_heating = Reaction(999)
non_fission_heating.redundant = True
for strT, total in total_heating.xs.items():
fission = fission_heating.xs.get(strT)
if fission is None:
continue
non_fission_heating.xs[strT] = Tabulated1D(
total.x, total.y - fission(total.x))
data.reactions[999] = non_fission_heating
return data
@classmethod
@ -602,6 +593,9 @@ class IncidentNeutron(EqualityMixin):
# If mass number hasn't been specified, make an educated guess
zaid, xs = ace.name.split('.')
if not xs.endswith('c'):
raise TypeError(
"{} is not a continuous-energy neutron ACE table.".format(ace))
name, element, Z, mass_number, metastable = \
get_metadata(int(zaid), metastable_scheme)
@ -744,7 +738,7 @@ class IncidentNeutron(EqualityMixin):
# Instantiate incident neutron data
data = cls(name, atomic_number, mass_number, metastable,
atomic_weight_ratio, temperature)
atomic_weight_ratio, [temperature])
if (2, 151) in ev.section:
data.resonances = res.Resonances.from_endf(ev)
@ -777,9 +771,10 @@ class IncidentNeutron(EqualityMixin):
for mt, rx in data.reactions.items():
if mt in (19, 20, 21, 38):
if (5, mt) not in ev.section:
neutron = data.reactions[18].products[0]
rx.products[0].applicability = neutron.applicability
rx.products[0].distribution = neutron.distribution
if rx.products:
neutron = data.reactions[18].products[0]
rx.products[0].applicability = neutron.applicability
rx.products[0].distribution = neutron.distribution
# Read fission energy release (requires that we already know nu for
# fission)
@ -826,34 +821,6 @@ class IncidentNeutron(EqualityMixin):
for table in lib.tables[1:]:
data.add_temperature_from_ace(table)
# Add fission energy release data
ev = evaluation if evaluation is not None else Evaluation(filename)
if (1, 458) in ev.section:
data.fission_energy = FissionEnergyRelease.from_endf(ev, data)
# Add 318 fission heating data from heatr
non_fission_heating = Reaction(999)
non_fission_heating.redundant = True
fission_heating = Reaction(318)
heatr_evals = get_evaluations(kwargs["heatr"])
for heatr in heatr_evals:
temp = "{}K".format(round(heatr.target["temperature"]))
f318 = StringIO(heatr.section[3, 318])
get_head_record(f318)
_params, fission_kerma = get_tab1_record(f318)
fission_heating.xs[temp] = fission_kerma
total_heating_xs = data.reactions[301].xs.get(temp)
if total_heating_xs is None:
continue
non_fission_heating.xs[temp] = Tabulated1D(
fission_kerma.x,
total_heating_xs(fission_kerma.x) - fission_kerma.y,
breakpoints=fission_kerma.breakpoints,
interpolation=fission_kerma.interpolation)
data.reactions[318] = fission_heating
data.reactions[999] = non_fission_heating
# Add 0K elastic scattering cross section
if '0K' not in data.energy:
pendf = Evaluation(kwargs['pendf'])
@ -863,6 +830,74 @@ class IncidentNeutron(EqualityMixin):
data.energy['0K'] = xs.x
data[2].xs['0K'] = xs
# Add fission energy release data
ev = evaluation if evaluation is not None else Evaluation(filename)
if (1, 458) in ev.section:
data.fission_energy = f = FissionEnergyRelease.from_endf(ev, data)
else:
f = None
# For energy deposition, we want to store two different KERMAs:
# one calculated assuming outgoing photons deposit their energy
# locally, and one calculated assuming they carry their energy
# away. This requires two HEATR runs (which make_ace does by
# default). Here, we just need to correct for the fact that NJOY
# uses a fission heating number of h = EFR, whereas we want:
#
# 1) h = EFR + EGP + EGD + EB (for local case)
# 2) h = EFR + EB (for non-local case)
#
# The best way to handle this is to subtract off the fission
# KERMA that NJOY calculates and add back exactly what we want.
# If NJOY is not run with HEATR at all, skip everything below
if not kwargs["heatr"]:
return data
# Helper function to get a cross section from an ENDF file on a
# given energy grid
def get_file3_xs(ev, mt, E):
file_obj = StringIO(ev.section[3, mt])
get_head_record(file_obj)
_, xs = get_tab1_record(file_obj)
return xs(E)
heating_local = Reaction(901)
heating_local.redundant = True
heatr_evals = get_evaluations(kwargs["heatr"])
heatr_local_evals = get_evaluations(kwargs["heatr"] + "_local")
for ev, ev_local in zip(heatr_evals, heatr_local_evals):
temp = "{}K".format(round(ev.target["temperature"]))
# Get total KERMA (originally from ACE file) and energy grid
kerma = data.reactions[301].xs[temp]
E = kerma.x
if f is not None:
# Replace fission KERMA with (EFR + EB)*sigma_f
fission = data.reactions[18].xs[temp]
kerma_fission = get_file3_xs(ev, 318, E)
kerma.y = kerma.y - kerma_fission + (
f.fragments(E) + f.betas(E)) * fission(E)
# For local KERMA, we first need to get the values from the
# HEATR run with photon energy deposited locally and put
# them on the same energy grid
kerma_local = get_file3_xs(ev_local, 301, E)
if f is not None:
# When photons deposit their energy locally, we replace the
# fission KERMA with (EFR + EGP + EGD + EB)*sigma_f
kerma_fission_local = get_file3_xs(ev_local, 318, E)
kerma_local = kerma_local - kerma_fission_local + (
f.fragments(E) + f.prompt_photons(E)
+ f.delayed_photons(E) + f.betas(E))*fission(E)
heating_local.xs[temp] = Tabulated1D(E, kerma_local)
data.reactions[901] = heating_local
return data
def _get_redundant_reaction(self, mt, mts):
@ -881,16 +916,17 @@ class IncidentNeutron(EqualityMixin):
Redundant reaction
"""
# Get energy grid
strT = self.temperatures[0]
energy = self.energy[strT]
rx = Reaction(mt)
xss = [self.reactions[mt_i].xs[strT] for mt_i in mts]
idx = min([xs._threshold_idx if hasattr(xs, '_threshold_idx')
else 0 for xs in xss])
rx.xs[strT] = Tabulated1D(energy[idx:], Sum(xss)(energy[idx:]))
rx.xs[strT]._threshold_idx = idx
# Get energy grid
for strT in self.temperatures:
energy = self.energy[strT]
xss = [self.reactions[mt_i].xs[strT] for mt_i in mts]
idx = min([xs._threshold_idx if hasattr(xs, '_threshold_idx')
else 0 for xs in xss])
rx.xs[strT] = Tabulated1D(energy[idx:], Sum(xss)(energy[idx:]))
rx.xs[strT]._threshold_idx = idx
rx.redundant = True
return rx

View file

@ -10,7 +10,7 @@ from . import endf
# For a given MAT number, give a name for the ACE table and a list of ZAID
# identifiers
# identifiers. This is based on Appendix C in the ENDF manual.
ThermalTuple = namedtuple('ThermalTuple', ['name', 'zaids', 'nmix'])
_THERMAL_DATA = {
1: ThermalTuple('hh2o', [1001], 1),
@ -23,31 +23,77 @@ _THERMAL_DATA = {
11: ThermalTuple('dd2o', [1002], 1),
12: ThermalTuple('parad', [1002], 1),
13: ThermalTuple('orthod', [1002], 1),
14: ThermalTuple('dice', [1002], 1),
26: ThermalTuple('be', [4009], 1),
27: ThermalTuple('bebeo', [4009], 1),
31: ThermalTuple('graph', [6000, 6012, 6013], 1),
28: ThermalTuple('bebe2c', [4009], 1),
30: ThermalTuple('graph', [6000, 6012, 6013], 1),
31: ThermalTuple('grph10', [6000, 6012, 6013], 1),
32: ThermalTuple('grph30', [6000, 6012, 6013], 1),
33: ThermalTuple('lch4', [1001], 1),
34: ThermalTuple('sch4', [1001], 1),
35: ThermalTuple('sch4p2', [1001], 1),
37: ThermalTuple('hch2', [1001], 1),
38: ThermalTuple('mesi00', [1001], 1),
39: ThermalTuple('lucite', [1001], 1),
40: ThermalTuple('benz', [1001, 6000, 6012], 2),
41: ThermalTuple('od2o', [8016, 8017, 8018], 1),
42: ThermalTuple('tol00', [1001], 1),
43: ThermalTuple('sisic', [14028, 14029, 14030], 1),
44: ThermalTuple('csic', [6000, 6012, 6013], 1),
45: ThermalTuple('ouo2', [8016, 8017, 8018], 1),
46: ThermalTuple('obeo', [8016, 8017, 8018], 1),
47: ThermalTuple('sio2-a', [8016, 8017, 8018, 14028, 14029, 14030], 3),
48: ThermalTuple('uuo2', [92238], 1),
48: ThermalTuple('osap00', [92238], 1),
49: ThermalTuple('sio2-b', [8016, 8017, 8018, 14028, 14029, 14030], 3),
50: ThermalTuple('oice', [8016, 8017, 8018], 1),
51: ThermalTuple('od2o', [8016, 8017, 8018], 1),
52: ThermalTuple('mg24', [12024], 1),
53: ThermalTuple('al27', [13027], 1),
55: ThermalTuple('yyh2', [39089], 1),
56: ThermalTuple('fe56', [26056], 1),
58: ThermalTuple('zrzrh', [40000, 40090, 40091, 40092, 40094, 40096], 1),
59: ThermalTuple('cacah2', [20040, 20042, 20043, 20044, 20046, 20048], 1),
75: ThermalTuple('ouo2', [8016, 8017, 8018], 1),
59: ThermalTuple('si00', [14028], 1),
60: ThermalTuple('asap00', [13027], 1),
71: ThermalTuple('n-un', [7014, 7015], 1),
72: ThermalTuple('u-un', [92238], 1),
75: ThermalTuple('uuo2', [8016, 8017, 8018], 1),
}
def _get_thermal_data(ev, mat):
"""Return appropriate ThermalTuple, accounting for bugs."""
# JEFF assigns MAT=59 to Ca in CaH2 (which is supposed to be silicon).
if ev.info['library'][0] == 'JEFF':
if ev.material == 59:
if 'CaH2' in ''.join(ev.info['description']):
zaids = [20040, 20042, 20043, 20044, 20046, 20048]
return ThermalTuple('cacah2', zaids, 1)
# Before ENDF/B-VIII.0, crystalline graphite was MAT=31
if ev.info['library'] != ('ENDF/B', 8, 0):
if ev.material == 31:
return _THERMAL_DATA[30]
# ENDF/B incorrectly assigns MAT numbers for UO2
#
# Material | ENDF Manual | VII.0 | VII.1 | VIII.0
# ---------|-------------|-------|-------|-------
# O in UO2 | 45 | 75 | 75 | 75
# U in UO2 | 75 | 76 | 48 | 48
if ev.info['library'][0] == 'ENDF/B':
if ev.material == 75:
return _THERMAL_DATA[45]
version = ev.info['library'][1:]
if version in ((7, 1), (8, 0)) and ev.material == 48:
return _THERMAL_DATA[75]
if version == (7, 0) and ev.material == 76:
return _THERMAL_DATA[75]
# If not a problematic material, use the dictionary as is
return _THERMAL_DATA[mat]
_TEMPLATE_RECONR = """
reconr / %%%%%%%%%%%%%%%%%%% Reconstruct XS for neutrons %%%%%%%%%%%%%%%%%%%%%%%
{nendf} {npendf}
@ -71,7 +117,14 @@ broadr / %%%%%%%%%%%%%%%%%%%%%%% Doppler broaden XS %%%%%%%%%%%%%%%%%%%%%%%%%%%%
_TEMPLATE_HEATR = """
heatr / %%%%%%%%%%%%%%%%%%%%%%%%% Add heating kerma %%%%%%%%%%%%%%%%%%%%%%%%%%%%
{nendf} {nheatr_in} {nheatr} /
{mat} 4 /
{mat} 4 0 0 0 /
302 318 402 444 /
"""
_TEMPLATE_HEATR_LOCAL = """
heatr / %%%%%%%%%%%%%%%%% Add heating kerma (local photons) %%%%%%%%%%%%%%%%%%%%
{nendf} {nheatr_in} {nheatr_local} /
{mat} 4 0 0 1 /
302 318 402 444 /
"""
@ -216,8 +269,7 @@ def make_pendf(filename, pendf='pendf', error=0.001, stdout=False):
def make_ace(filename, temperatures=None, acer=True, xsdir=None,
output_dir=None, pendf=False, error=0.001, broadr=True,
heatr=True, gaspr=True, purr=True, evaluation=None,
**kwargs):
heatr=True, gaspr=True, purr=True, evaluation=None, **kwargs):
"""Generate incident neutron ACE file from an ENDF file
File names can be passed to
@ -320,7 +372,11 @@ def make_ace(filename, temperatures=None, acer=True, xsdir=None,
# heatr
if heatr:
nheatr_in = nlast
nheatr = nheatr_in + 1
nheatr_local = nheatr_in + 1
tapeout[nheatr_local] = (output_dir / "heatr_local") if heatr is True \
else heatr + '_local'
commands += _TEMPLATE_HEATR_LOCAL
nheatr = nheatr_local + 1
tapeout[nheatr] = (output_dir / "heatr") if heatr is True else heatr
commands += _TEMPLATE_HEATR
nlast = nheatr
@ -434,7 +490,8 @@ def make_ace_thermal(filename, filename_thermal, temperatures=None,
mat_thermal = ev_thermal.material
zsymam_thermal = ev_thermal.target['zsymam']
data = _THERMAL_DATA[mat_thermal]
# Determine name, isotopes based on MAT number
data = _get_thermal_data(ev_thermal, mat_thermal)
zaids = ' '.join(str(zaid) for zaid in data.zaids[:3])
# Determine name of library

View file

@ -549,7 +549,9 @@ class IncidentPhoton(EqualityMixin):
ace = get_table(ace_or_filename)
# Get atomic number based on name of ACE table
zaid = ace.name.split('.')[0]
zaid, xs = ace.name.split('.')
if not xs.endswith('p'):
raise TypeError("{} is not a photoatomic transport ACE table.".format(ace))
Z = get_metadata(int(zaid))[2]
# Read each reaction

View file

@ -54,9 +54,8 @@ REACTION_NAME = {1: '(n,total)', 2: '(n,elastic)', 4: '(n,level)',
198: '(n,n3p)', 199: '(n,3n2pa)', 200: '(n,5n2p)', 203: '(n,Xp)',
204: '(n,Xd)', 205: '(n,Xt)', 206: '(n,X3He)', 207: '(n,Xa)',
301: 'heating', 444: 'damage-energy',
318: "fission-heating", 999: "non-fission-heating",
649: '(n,pc)', 699: '(n,dc)', 749: '(n,tc)', 799: '(n,3Hec)',
849: '(n,ac)', 891: '(n,2nc)'}
849: '(n,ac)', 891: '(n,2nc)', 901: 'heating-local'}
REACTION_NAME.update({i: '(n,n{})'.format(i - 50) for i in range(50, 91)})
REACTION_NAME.update({i: '(n,p{})'.format(i - 600) for i in range(600, 649)})
REACTION_NAME.update({i: '(n,d{})'.format(i - 650) for i in range(650, 699)})

View file

@ -33,10 +33,12 @@ _THERMAL_NAMES = {
'c_Be': ('be', 'be-metal', 'be-met', 'be00'),
'c_BeO': ('beo',),
'c_Be_in_BeO': ('bebeo', 'be-beo', 'be-o', 'be/o', 'bbeo00'),
'c_Be_in_Be2C': ('bebe2c',),
'c_C6H6': ('benz', 'c6h6'),
'c_C_in_SiC': ('csic', 'c-sic'),
'c_Ca_in_CaH2': ('cah', 'cah00'),
'c_D_in_D2O': ('dd2o', 'd-d2o', 'hwtr', 'hw', 'dhw00'),
'c_D_in_D2O_ice': ('dice',),
'c_Fe56': ('fe', 'fe56', 'fe-56'),
'c_Graphite': ('graph', 'grph', 'gr', 'gr00'),
'c_Graphite_10p': ('grph10',),
@ -45,6 +47,7 @@ _THERMAL_NAMES = {
'c_H_in_CH2': ('hch2', 'poly', 'pol', 'h-poly', 'pol00'),
'c_H_in_CH4_liquid': ('lch4', 'lmeth'),
'c_H_in_CH4_solid': ('sch4', 'smeth'),
'c_H_in_CH4_solid_phase_II': ('sch4p2',),
'c_H_in_H2O': ('hh2o', 'h-h2o', 'lwtr', 'lw', 'lw00'),
'c_H_in_H2O_solid': ('hice', 'h-ice', 'ice00'),
'c_H_in_C5O2H8': ('lucite', 'c5o2h8', 'h-luci'),
@ -600,6 +603,8 @@ class ThermalScattering(EqualityMixin):
# Get new name that is GND-consistent
ace_name, xs = ace.name.split('.')
if not xs.endswith('t'):
raise TypeError("{} is not a thermal scattering ACE table.".format(ace))
name = get_thermal_name(ace_name)
# Assign temperature to the running list

View file

@ -4,12 +4,11 @@ openmc.deplete
A depletion front-end tool.
"""
from sys import exit
import sys
from unittest.mock import Mock
from h5py import get_config
from unittest.mock import Mock
from .dummy_comm import DummyCommunicator
try:
@ -22,7 +21,7 @@ try:
if not get_config().mpi and comm.size > 1:
# Raise exception only on process 0
if comm.rank:
exit()
sys.exit()
raise RuntimeError(
"Need parallel HDF5 installed to perform depletion with MPI"
)
@ -35,7 +34,10 @@ from .nuclide import *
from .chain import *
from .operator import *
from .reaction_rates import *
from .abc import *
from .atom_number import *
from .results import *
from .results_list import *
from .integrators import *
from . import abc
from . import cram
from . import helpers

View file

@ -5,6 +5,7 @@ to run a full depletion simulation.
"""
from collections import namedtuple
from collections import defaultdict
from collections.abc import Iterable
import os
from pathlib import Path
@ -17,12 +18,19 @@ from numpy import nonzero, empty, asarray
from uncertainties import ufloat
from openmc.data import DataLibrary, JOULE_PER_EV
from openmc.capi import MaterialFilter, Tally
from openmc.lib import MaterialFilter, Tally
from openmc.checkvalue import check_type, check_greater_than
from .results import Results
from .chain import Chain
from .results_list import ResultsList
__all__ = [
"OperatorResult", "TransportOperator", "ReactionRateHelper",
"EnergyHelper", "FissionYieldHelper", "TalliedFissionYieldHelper",
"Integrator", "SIIntegrator", "DepSystemSolver"]
OperatorResult = namedtuple('OperatorResult', ['k', 'rates'])
OperatorResult.__doc__ = """\
Result of applying transport operator
@ -376,14 +384,17 @@ class FissionYieldHelper(ABC):
Attributes
----------
constant_yields : dict of str to :class:`openmc.deplete.FissionYield`
constant_yields : collections.defaultdict
Fission yields for all nuclides that only have one set of
fission yield data. Can be accessed as ``{parent: {product: yield}}``
fission yield data. Dictionary of form ``{str: {str: float}}``
representing yields for ``{parent: {product: yield}}``. Default
return object is an empty dictionary
"""
def __init__(self, chain_nuclides):
self._chain_nuclides = {}
self._constant_yields = {}
self._constant_yields = defaultdict(dict)
# Get all nuclides with fission yield data
for nuc in chain_nuclides:
@ -407,14 +418,16 @@ class FissionYieldHelper(ABC):
Parameters
----------
local_mat_index : int
Index for material tracked on this process that
exists in :attr:`local_mat_index` and fits within
the first axis in :attr:`results`
Index for the material with requested fission yields.
Should correspond to the material represented in
``mat_indexes[local_mat_index]`` during
:meth:`generate_tallies`.
Returns
-------
library : dict
Dictionary of ``{parent: {product: fyield}}``
library : collections.abc.Mapping
Dictionary-like object mapping ``{str: {str: float}``.
This reflects fission yields for ``{parent: {product: fyield}}``.
"""
@staticmethod
@ -438,7 +451,7 @@ class FissionYieldHelper(ABC):
Parameters
----------
materials : iterable of C-API materials
Materials to be used in :class:`openmc.capi.MaterialFilter`
Materials to be used in :class:`openmc.lib.MaterialFilter`
mat_indexes : iterable of int
Indices of tallied materials that will have their fission
yields computed by this helper. Necessary as the
@ -520,8 +533,8 @@ class TalliedFissionYieldHelper(FissionYieldHelper):
Parameters
----------
materials : iterable of :class:`openmc.capi.Material`
Materials to be used in :class:`openmc.capi.MaterialFilter`
materials : iterable of :class:`openmc.lib.Material`
Materials to be used in :class:`openmc.lib.MaterialFilter`
mat_indexes : iterable of int
Indices of tallied materials that will have their fission
yields computed by this helper. Necessary as the
@ -533,6 +546,7 @@ class TalliedFissionYieldHelper(FissionYieldHelper):
# Tally group-wise fission reaction rates
self._fission_rate_tally = Tally()
self._fission_rate_tally.writable = False
self._fission_rate_tally.scores = ['fission']
self._fission_rate_tally.filters = [MaterialFilter(materials)]
@ -842,3 +856,40 @@ class SIIntegrator(Integrator):
Results.save(self.operator, [conc], [res_list[-1]], [t, t],
p, self._i_res + len(self), proc_time)
self.operator.write_bos_data(self._i_res + len(self))
class DepSystemSolver(ABC):
r"""Abstract class for solving depletion equations
Responsible for solving
.. math::
\frac{\partial \vec{N}}{\partial t} = \bar{A}\vec{N}(t),
for :math:`0< t\leq t +\Delta t`, given :math:`\vec{N}(0) = \vec{N}_0`
"""
@abstractmethod
def __call__(self, A, n0, dt):
"""Solve the linear system of equations for depletion
Parameters
----------
A : scipy.sparse.csr_matrix
Sparse transmutation matrix ``A[j, i]`` desribing rates at
which isotope ``i`` transmutes to isotope ``j``
n0 : numpy.ndarray
Initial compositions, typically given in number of atoms in some
material or an atom density
dt : float
Time [s] of the specific interval to be solved
Returns
-------
numpy.ndarray
Final compositions after ``dt``. Should be of identical shape
to ``n0``.
"""

View file

@ -45,6 +45,8 @@ _REACTIONS = [
]
__all__ = ["Chain"]
def replace_missing(product, decay_data):
"""Replace missing product with suitable decay daughter.
@ -398,7 +400,7 @@ class Chain(object):
clean_indentation(root_elem)
tree.write(str(filename), encoding='utf-8')
def get_thermal_fission_yields(self):
def get_default_fission_yields(self):
"""Return fission yields at lowest incident neutron energy
Used as the default set of fission yields for :meth:`form_matrix`
@ -412,7 +414,7 @@ class Chain(object):
names of nuclides with yield data and ``f_yield``
is a float for the fission yield.
"""
out = {}
out = defaultdict(dict)
for nuc in self.nuclides:
if nuc.yield_data is None:
continue
@ -440,13 +442,13 @@ class Chain(object):
See Also
--------
:meth:`get_thermal_fission_yields`
:meth:`get_default_fission_yields`
"""
matrix = defaultdict(float)
reactions = set()
if fission_yields is None:
fission_yields = self.get_thermal_fission_yields()
fission_yields = self.get_default_fission_yields()
for i, nuc in enumerate(self.nuclides):
@ -721,7 +723,7 @@ class Chain(object):
@property
def fission_yields(self):
if self._fission_yields is None:
self._fission_yields = [self.get_thermal_fission_yields()]
self._fission_yields = [self.get_default_fission_yields()]
return self._fission_yields
@fission_yields.setter

View file

@ -3,6 +3,7 @@
Implements two different forms of CRAM for use in openmc.deplete.
"""
import numbers
from itertools import repeat
from multiprocessing import Pool
import time
@ -11,9 +12,12 @@ import numpy as np
import scipy.sparse as sp
import scipy.sparse.linalg as sla
from . import comm
from openmc.checkvalue import check_type, check_length
from .abc import DepSystemSolver
__all__ = ["deplete", "timed_deplete", "CRAM16", "CRAM48"]
__all__ = [
"deplete", "timed_deplete", "CRAM16", "CRAM48",
"Cram16Solver", "Cram48Solver", "IPFCramSolver"]
def deplete(chain, x, rates, dt, matrix_func=None):
@ -83,147 +87,169 @@ def timed_deplete(*args, **kwargs):
return time.time() - start, results
def CRAM16(A, n0, dt):
"""Chebyshev Rational Approximation Method, order 16
class IPFCramSolver(DepSystemSolver):
r"""CRAM depletion solver that uses incomplete partial factorization
Algorithm is the 16th order Chebyshev Rational Approximation Method,
implemented in the more stable `incomplete partial fraction (IPF)
<https://doi.org/10.13182/NSE15-26>`_ form.
Provides a :meth:`__call__` that utilizes an incomplete
partial factorization (IPF) for the Chebyshev Rational Approximation
Method (CRAM), as described in the following paper: M. Pusa, "`Higher-Order
Chebyshev Rational Approximation Method and Application to Burnup Equations
<https://doi.org/10.13182/NSE15-26>`_," Nucl. Sci. Eng., 182:3, 297-318.
Parameters
----------
A : scipy.linalg.csr_matrix
Matrix to take exponent of.
n0 : numpy.array
Vector to operate a matrix exponent on.
dt : float
Time to integrate to.
alpha : numpy.ndarray
Complex residues of poles used in the factorization. Must be a
vector with even number of items.
theta : numpy.ndarray
Complex poles. Must have an equal size as ``alpha``.
alpha0 : float
Limit of the approximation at infinity
Returns
-------
numpy.array
Results of the matrix exponent.
"""
alpha = np.array([+2.124853710495224e-16,
+5.464930576870210e+3 - 3.797983575308356e+4j,
+9.045112476907548e+1 - 1.115537522430261e+3j,
+2.344818070467641e+2 - 4.228020157070496e+2j,
+9.453304067358312e+1 - 2.951294291446048e+2j,
+7.283792954673409e+2 - 1.205646080220011e+5j,
+3.648229059594851e+1 - 1.155509621409682e+2j,
+2.547321630156819e+1 - 2.639500283021502e+1j,
+2.394538338734709e+1 - 5.650522971778156e+0j],
dtype=np.complex128)
theta = np.array([+0.0,
+3.509103608414918 + 8.436198985884374j,
+5.948152268951177 + 3.587457362018322j,
-5.264971343442647 + 16.22022147316793j,
+1.419375897185666 + 10.92536348449672j,
+6.416177699099435 + 1.194122393370139j,
+4.993174737717997 + 5.996881713603942j,
-1.413928462488886 + 13.49772569889275j,
-10.84391707869699 + 19.27744616718165j],
dtype=np.complex128)
n = A.shape[0]
alpha0 = 2.124853710495224e-16
k = 8
y = np.array(n0, dtype=np.float64)
for l in range(1, k+1):
y = 2.0*np.real(alpha[l]*sla.spsolve(A*dt - theta[l]*sp.eye(n), y)) + y
y *= alpha0
return y
def CRAM48(A, n0, dt):
"""Chebyshev Rational Approximation Method, order 48
Algorithm is the 48th order Chebyshev Rational Approximation Method,
implemented in the more stable `incomplete partial fraction (IPF)
<https://doi.org/10.13182/NSE15-26>`_ form.
Parameters
Attributes
----------
A : scipy.linalg.csr_matrix
Matrix to take exponent of.
n0 : numpy.array
Vector to operate a matrix exponent on.
dt : float
Time to integrate to.
Returns
-------
numpy.array
Results of the matrix exponent.
alpha : numpy.ndarray
Complex residues of poles :attr:`theta` in the incomplete partial
factorization. Denoted as :math:`\tilde{\alpha}`
theta : numpy.ndarray
Complex poles :math:`\theta` of the rational approximation
alpha0 : float
Limit of the approximation at infinity
"""
theta_r = np.array([-4.465731934165702e+1, -5.284616241568964e+0,
-8.867715667624458e+0, +3.493013124279215e+0,
+1.564102508858634e+1, +1.742097597385893e+1,
-2.834466755180654e+1, +1.661569367939544e+1,
+8.011836167974721e+0, -2.056267541998229e+0,
+1.449208170441839e+1, +1.853807176907916e+1,
+9.932562704505182e+0, -2.244223871767187e+1,
+8.590014121680897e-1, -1.286192925744479e+1,
+1.164596909542055e+1, +1.806076684783089e+1,
+5.870672154659249e+0, -3.542938819659747e+1,
+1.901323489060250e+1, +1.885508331552577e+1,
-1.734689708174982e+1, +1.316284237125190e+1])
theta_i = np.array([+6.233225190695437e+1, +4.057499381311059e+1,
+4.325515754166724e+1, +3.281615453173585e+1,
+1.558061616372237e+1, +1.076629305714420e+1,
+5.492841024648724e+1, +1.316994930024688e+1,
+2.780232111309410e+1, +3.794824788914354e+1,
+1.799988210051809e+1, +5.974332563100539e+0,
+2.532823409972962e+1, +5.179633600312162e+1,
+3.536456194294350e+1, +4.600304902833652e+1,
+2.287153304140217e+1, +8.368200580099821e+0,
+3.029700159040121e+1, +5.834381701800013e+1,
+1.194282058271408e+0, +3.583428564427879e+0,
+4.883941101108207e+1, +2.042951874827759e+1])
theta = np.array(theta_r + theta_i * 1j, dtype=np.complex128)
def __init__(self, alpha, theta, alpha0):
check_type("alpha", alpha, np.ndarray, numbers.Complex)
check_type("theta", theta, np.ndarray, numbers.Complex)
check_length("theta", theta, alpha.size)
check_type("alpha0", alpha0, numbers.Real)
self.alpha = alpha
self.theta = theta
self.alpha0 = alpha0
alpha_r = np.array([+6.387380733878774e+2, +1.909896179065730e+2,
+4.236195226571914e+2, +4.645770595258726e+2,
+7.765163276752433e+2, +1.907115136768522e+3,
+2.909892685603256e+3, +1.944772206620450e+2,
+1.382799786972332e+5, +5.628442079602433e+3,
+2.151681283794220e+2, +1.324720240514420e+3,
+1.617548476343347e+4, +1.112729040439685e+2,
+1.074624783191125e+2, +8.835727765158191e+1,
+9.354078136054179e+1, +9.418142823531573e+1,
+1.040012390717851e+2, +6.861882624343235e+1,
+8.766654491283722e+1, +1.056007619389650e+2,
+7.738987569039419e+1, +1.041366366475571e+2])
alpha_i = np.array([-6.743912502859256e+2, -3.973203432721332e+2,
-2.041233768918671e+3, -1.652917287299683e+3,
-1.783617639907328e+4, -5.887068595142284e+4,
-9.953255345514560e+3, -1.427131226068449e+3,
-3.256885197214938e+6, -2.924284515884309e+4,
-1.121774011188224e+3, -6.370088443140973e+4,
-1.008798413156542e+6, -8.837109731680418e+1,
-1.457246116408180e+2, -6.388286188419360e+1,
-2.195424319460237e+2, -6.719055740098035e+2,
-1.693747595553868e+2, -1.177598523430493e+1,
-4.596464999363902e+3, -1.738294585524067e+3,
-4.311715386228984e+1, -2.777743732451969e+2])
alpha = np.array(alpha_r + alpha_i * 1j, dtype=np.complex128)
n = A.shape[0]
def __call__(self, A, n0, dt):
"""Solve depletion equations using IPF CRAM
alpha0 = 2.258038182743983e-47
Parameters
----------
A : scipy.sparse.csr_matrix
Sparse transmutation matrix ``A[j, i]`` desribing rates at
which isotope ``i`` transmutes to isotope ``j``
n0 : numpy.ndarray
Initial compositions, typically given in number of atoms in some
material or an atom density
dt : float
Time [s] of the specific interval to be solved
k = 24
Returns
-------
numpy.ndarray
Final compositions after ``dt``
y = np.array(n0, dtype=np.float64)
for l in range(k):
y = 2.0*np.real(alpha[l]*sla.spsolve(A*dt - theta[l]*sp.eye(n), y)) + y
"""
A = sp.csr_matrix(A * dt, dtype=np.float64)
y = np.asarray(n0, dtype=np.float64)
ident = sp.eye(A.shape[0])
for alpha, theta in zip(self.alpha, self.theta):
y += 2*np.real(alpha*sla.spsolve(A - theta*ident, y))
return y * self.alpha0
y *= alpha0
return y
# Coefficients for IPF Cram 16
c16_alpha = np.array([
+5.464930576870210e+3 - 3.797983575308356e+4j,
+9.045112476907548e+1 - 1.115537522430261e+3j,
+2.344818070467641e+2 - 4.228020157070496e+2j,
+9.453304067358312e+1 - 2.951294291446048e+2j,
+7.283792954673409e+2 - 1.205646080220011e+5j,
+3.648229059594851e+1 - 1.155509621409682e+2j,
+2.547321630156819e+1 - 2.639500283021502e+1j,
+2.394538338734709e+1 - 5.650522971778156e+0j],
dtype=np.complex128)
c16_theta = np.array([
+3.509103608414918 + 8.436198985884374j,
+5.948152268951177 + 3.587457362018322j,
-5.264971343442647 + 16.22022147316793j,
+1.419375897185666 + 10.92536348449672j,
+6.416177699099435 + 1.194122393370139j,
+4.993174737717997 + 5.996881713603942j,
-1.413928462488886 + 13.49772569889275j,
-10.84391707869699 + 19.27744616718165j],
dtype=np.complex128)
c16_alpha0 = 2.124853710495224e-16
Cram16Solver = IPFCramSolver(c16_alpha, c16_theta, c16_alpha0)
CRAM16 = Cram16Solver.__call__
del c16_alpha, c16_alpha0, c16_theta
# Coefficients for 48th order IPF Cram
theta_r = np.array([
-4.465731934165702e+1, -5.284616241568964e+0,
-8.867715667624458e+0, +3.493013124279215e+0,
+1.564102508858634e+1, +1.742097597385893e+1,
-2.834466755180654e+1, +1.661569367939544e+1,
+8.011836167974721e+0, -2.056267541998229e+0,
+1.449208170441839e+1, +1.853807176907916e+1,
+9.932562704505182e+0, -2.244223871767187e+1,
+8.590014121680897e-1, -1.286192925744479e+1,
+1.164596909542055e+1, +1.806076684783089e+1,
+5.870672154659249e+0, -3.542938819659747e+1,
+1.901323489060250e+1, +1.885508331552577e+1,
-1.734689708174982e+1, +1.316284237125190e+1])
theta_i = np.array([
+6.233225190695437e+1, +4.057499381311059e+1,
+4.325515754166724e+1, +3.281615453173585e+1,
+1.558061616372237e+1, +1.076629305714420e+1,
+5.492841024648724e+1, +1.316994930024688e+1,
+2.780232111309410e+1, +3.794824788914354e+1,
+1.799988210051809e+1, +5.974332563100539e+0,
+2.532823409972962e+1, +5.179633600312162e+1,
+3.536456194294350e+1, +4.600304902833652e+1,
+2.287153304140217e+1, +8.368200580099821e+0,
+3.029700159040121e+1, +5.834381701800013e+1,
+1.194282058271408e+0, +3.583428564427879e+0,
+4.883941101108207e+1, +2.042951874827759e+1])
c48_theta = np.array(theta_r + theta_i * 1j, dtype=np.complex128)
alpha_r = np.array([
+6.387380733878774e+2, +1.909896179065730e+2,
+4.236195226571914e+2, +4.645770595258726e+2,
+7.765163276752433e+2, +1.907115136768522e+3,
+2.909892685603256e+3, +1.944772206620450e+2,
+1.382799786972332e+5, +5.628442079602433e+3,
+2.151681283794220e+2, +1.324720240514420e+3,
+1.617548476343347e+4, +1.112729040439685e+2,
+1.074624783191125e+2, +8.835727765158191e+1,
+9.354078136054179e+1, +9.418142823531573e+1,
+1.040012390717851e+2, +6.861882624343235e+1,
+8.766654491283722e+1, +1.056007619389650e+2,
+7.738987569039419e+1, +1.041366366475571e+2])
alpha_i = np.array([
-6.743912502859256e+2, -3.973203432721332e+2,
-2.041233768918671e+3, -1.652917287299683e+3,
-1.783617639907328e+4, -5.887068595142284e+4,
-9.953255345514560e+3, -1.427131226068449e+3,
-3.256885197214938e+6, -2.924284515884309e+4,
-1.121774011188224e+3, -6.370088443140973e+4,
-1.008798413156542e+6, -8.837109731680418e+1,
-1.457246116408180e+2, -6.388286188419360e+1,
-2.195424319460237e+2, -6.719055740098035e+2,
-1.693747595553868e+2, -1.177598523430493e+1,
-4.596464999363902e+3, -1.738294585524067e+3,
-4.311715386228984e+1, -2.777743732451969e+2])
c48_alpha = np.array(alpha_r + alpha_i * 1j, dtype=np.complex128)
c48_alpha0 = 2.258038182743983e-47
Cram48Solver = IPFCramSolver(c48_alpha, c48_theta, c48_alpha0)
del c48_alpha, c48_alpha0, c48_theta, alpha_r, alpha_i, theta_r, theta_i
CRAM48 = Cram48Solver.__call__

View file

@ -1,3 +1,5 @@
import sys
class DummyCommunicator(object):
rank = 0
size = 1
@ -25,3 +27,6 @@ class DummyCommunicator(object):
def scatter(self, sendobj, root=0):
return sendobj[0]
def Abort(self, exit_code_or_msg):
sys.exit(exit_code_or_msg)

View file

@ -5,11 +5,13 @@ from copy import deepcopy
from itertools import product
from numbers import Real
import bisect
from collections import defaultdict
from numpy import dot, zeros, newaxis
from . import comm
from openmc.checkvalue import check_type, check_greater_than
from openmc.capi import (
from openmc.lib import (
Tally, MaterialFilter, EnergyFilter, EnergyFunctionFilter)
from .abc import (
ReactionRateHelper, EnergyHelper, FissionYieldHelper,
@ -44,7 +46,7 @@ class DirectReactionRateHelper(ReactionRateHelper):
def generate_tallies(self, materials, scores):
"""Produce one-group reaction rate tally
Uses the :mod:`openmc.capi` to generate a tally
Uses the :mod:`openmc.lib` to generate a tally
of relevant reactions across all burnable materials.
Parameters
@ -57,6 +59,7 @@ class DirectReactionRateHelper(ReactionRateHelper):
``"(n, gamma)"``, needed for the reaction rate tally.
"""
self._rate_tally = Tally()
self._rate_tally.writable = False
self._rate_tally.scores = scores
self._rate_tally.filters = [MaterialFilter(materials)]
@ -156,6 +159,57 @@ class ChainFissionHelper(EnergyHelper):
self._energy += dot(fission_rates, self._fission_q_vector)
class EnergyScoreHelper(EnergyHelper):
"""Class responsible for obtaining system energy via a tally score
Parameters
----------
score : string
Valid score to use when obtaining system energy from OpenMC.
Defaults to "heating-local"
Attributes
----------
nuclides : list of str
List of nuclides with reaction rates. Not needed, but provided
for a consistent API across other :class:`EnergyHelper`
energy : float
System energy [eV] computed from the tally. Will be zero for
all MPI processes that are not the "master" process to avoid
artificially increasing the tallied energy.
score : str
Score used to obtain system energy
"""
def __init__(self, score="heating-local"):
super().__init__()
self.score = score
self._tally = None
def prepare(self, *args, **kwargs):
"""Create a tally for system energy production
Input arguments are not used, as the only information needed
is :attr:`score`
"""
self._tally = Tally()
self._tally.writable = False
self._tally.scores = [self.score]
def reset(self):
"""Obtain system energy from tally
Only the master process, ``comm.rank == 0`` will
have a non-zero :attr:`energy` taken from the tally.
This avoids accidentally scaling the system power by
the number of MPI processes
"""
super().reset()
if comm.rank == 0:
self._energy = self._tally.results[0, 0, 1]
# ------------------------------------
# Helper for collapsing fission yields
# ------------------------------------
@ -179,9 +233,11 @@ class ConstantFissionYieldHelper(FissionYieldHelper):
Attributes
----------
constant_yields : dict of str to :class:`openmc.deplete.FissionYield`
constant_yields : collections.defaultdict
Fission yields for all nuclides that only have one set of
fission yield data. Can be accessed as ``{parent: {product: yield}}``
fission yield data. Dictionary of form ``{str: {str: float}}``
representing yields for ``{parent: {product: yield}}``. Default
return object is an empty dictionary
energy : float
Energy of fission yield libraries.
"""
@ -237,7 +293,7 @@ class ConstantFissionYieldHelper(FissionYieldHelper):
Returns
-------
library : dict
library : collections.defaultdict
Dictionary of ``{parent: {product: fyield}}``
"""
return self.constant_yields
@ -282,6 +338,11 @@ class FissionYieldCutoffHelper(TalliedFissionYieldHelper):
fast_yields : dict
Dictionary of the form ``{parent: {product: yield}}``
with fast yields
constant_yields : collections.defaultdict
Fission yields for all nuclides that only have one set of
fission yield data. Dictionary of form ``{str: {str: float}}``
representing yields for ``{parent: {product: yield}}``. Default
return object is an empty dictionary
results : numpy.ndarray
Array of fission rate fractions with shape
``(n_mats, 2, n_nucs)``. ``results[:, 0]``
@ -362,13 +423,13 @@ class FissionYieldCutoffHelper(TalliedFissionYieldHelper):
def generate_tallies(self, materials, mat_indexes):
"""Use C API to produce a fission rate tally in burnable materials
Include a :class:`openmc.capi.EnergyFilter` to tally fission rates
Include a :class:`openmc.lib.EnergyFilter` to tally fission rates
above and below cutoff energy.
Parameters
----------
materials : iterable of :class:`openmc.capi.Material`
Materials to be used in :class:`openmc.capi.MaterialFilter`
materials : iterable of :class:`openmc.lib.Material`
Materials to be used in :class:`openmc.lib.MaterialFilter`
mat_indexes : iterable of int
Indices of tallied materials that will have their fission
yields computed by this helper. Necessary as the
@ -417,7 +478,7 @@ class FissionYieldCutoffHelper(TalliedFissionYieldHelper):
Returns
-------
library : dict
library : collections.defaultdict
Dictionary of ``{parent: {product: fyield}}``
"""
yields = self.constant_yields
@ -469,9 +530,11 @@ class AveragedFissionYieldHelper(TalliedFissionYieldHelper):
Attributes
----------
constant_yields : dict of str to :class:`openmc.deplete.FissionYield`
constant_yields : collections.defaultdict
Fission yields for all nuclides that only have one set of
fission yield data. Can be accessed as ``{parent: {product: yield}}``
fission yield data. Dictionary of form ``{str: {str: float}}``
representing yields for ``{parent: {product: yield}}``. Default
return object is an empty dictionary
results : None or numpy.ndarray
If tallies have been generated and unpacked, then the array will
have shape ``(n_mats, n_tnucs)``, where ``n_mats`` is the number
@ -490,8 +553,8 @@ class AveragedFissionYieldHelper(TalliedFissionYieldHelper):
Parameters
----------
materials : iterable of :class:`openmc.capi.Material`
Materials to be used in :class:`openmc.capi.MaterialFilter`
materials : iterable of :class:`openmc.lib.Material`
Materials to be used in :class:`openmc.lib.MaterialFilter`
mat_indexes : iterable of int
Indices of tallied materials that will have their fission
yields computed by this helper. Necessary as the
@ -509,6 +572,7 @@ class AveragedFissionYieldHelper(TalliedFissionYieldHelper):
func_filter = EnergyFunctionFilter()
func_filter.set_data((0, self._upper_energy), (0, self._upper_energy))
weighted_tally = Tally()
weighted_tally.writable = False
weighted_tally.scores = ['fission']
weighted_tally.filters = filters + [func_filter]
self._weighted_tally = weighted_tally
@ -569,12 +633,13 @@ class AveragedFissionYieldHelper(TalliedFissionYieldHelper):
Returns
-------
library : dict
Dictionary of ``{parent: {product: fyield}}``
library : collections.defaultdict
Dictionary of ``{parent: {product: fyield}}``. Default return
value is an empty dictionary
"""
if not self._tally_nucs:
return self.constant_yields
mat_yields = {}
mat_yields = defaultdict(dict)
average_energies = self.results[local_mat_index]
for avg_e, nuc in zip(average_energies, self._tally_nucs):
nuc_energies = nuc.yield_energies

View file

@ -17,6 +17,10 @@ from numpy import empty
from openmc.checkvalue import check_type
__all__ = [
"DecayTuple", "ReactionTuple", "Nuclide", "FissionYield",
"FissionYieldDistribution"]
DecayTuple = namedtuple('DecayTuple', 'type target branching_ratio')
DecayTuple.__doc__ = """\

View file

@ -7,19 +7,21 @@ densities is all done in-memory instead of through the filesystem.
"""
import sys
import copy
from collections import OrderedDict
from itertools import chain
import os
import time
import xml.etree.ElementTree as ET
from warnings import warn
import h5py
import numpy as np
from uncertainties import ufloat
import openmc
import openmc.capi
import openmc.lib
from . import comm
from .abc import TransportOperator, OperatorResult
from .atom_number import AtomNumber
@ -27,7 +29,10 @@ from .reaction_rates import ReactionRates
from .results_list import ResultsList
from .helpers import (
DirectReactionRateHelper, ChainFissionHelper, ConstantFissionYieldHelper,
FissionYieldCutoffHelper, AveragedFissionYieldHelper)
FissionYieldCutoffHelper, AveragedFissionYieldHelper, EnergyScoreHelper)
__all__ = ["Operator", "OperatorResult"]
def _distribute(items):
@ -78,9 +83,15 @@ class Operator(TransportOperator):
diff_burnable_mats : bool, optional
Whether to differentiate burnable materials with multiple instances.
Default: False.
energy_mode : {"energy-deposition", "fission-q"}
Indicator for computing system energy. ``"energy-deposition"`` will
compute with a single energy deposition tally, taking fission energy
release data and heating into consideration. ``"fission-q"`` will
use the fission Q values from the depletion chain
fission_q : dict, optional
Dictionary of nuclides and their fission Q values [eV]. If not given,
values will be pulled from the ``chain_file``.
values will be pulled from the ``chain_file``. Only applicable
if ``"energy_mode" == "fission-q"``
dilute_initial : float, optional
Initial atom density [atoms/cm^3] to add for nuclides that are zero
in initial condition to ensure they exist in the decay chain.
@ -128,7 +139,7 @@ class Operator(TransportOperator):
burnable_mats : list of str
All burnable material IDs
heavy_metal : float
Initial heavy metal inventory
Initial heavy metal inventory [g]
local_mats : list of str
All burnable material IDs being managed by a single process
prev_res : ResultsList or None
@ -144,13 +155,22 @@ class Operator(TransportOperator):
}
def __init__(self, geometry, settings, chain_file=None, prev_results=None,
diff_burnable_mats=False, fission_q=None,
dilute_initial=1.0e3, fission_yield_mode="constant",
fission_yield_opts=None):
diff_burnable_mats=False, energy_mode="fission-q",
fission_q=None, dilute_initial=1.0e3,
fission_yield_mode="constant", fission_yield_opts=None):
if fission_yield_mode not in self._fission_helpers:
raise KeyError(
"fission_yield_mode must be one of {}, not {}".format(
", ".join(self._fission_helpers), fission_yield_mode))
if energy_mode == "energy-deposition":
if fission_q is not None:
warn("Fission Q dictionary not used if energy deposition "
"is used")
fission_q = None
elif energy_mode != "fission-q":
raise ValueError(
"energy_mode {} not supported. Must be energy-deposition "
"or fission-q".format(energy_mode))
super().__init__(chain_file, fission_q, dilute_initial, prev_results)
self.round_number = False
self.prev_res = None
@ -204,7 +224,11 @@ class Operator(TransportOperator):
# Get classes to assist working with tallies
self._rate_helper = DirectReactionRateHelper(
self.reaction_rates.n_nuc, self.reaction_rates.n_react)
self._energy_helper = ChainFissionHelper()
if energy_mode == "fission-q":
self._energy_helper = ChainFissionHelper()
else:
score = "heating" if settings.photon_transport else "heating-local"
self._energy_helper = EnergyScoreHelper(score)
# Select and create fission yield helper
fission_helper = self._fission_helpers[fission_yield_mode]
@ -216,6 +240,10 @@ class Operator(TransportOperator):
def __call__(self, vec, power):
"""Runs a simulation.
Simulation will abort under the following circumstances:
1) No energy is computed using OpenMC tallies.
Parameters
----------
vec : list of numpy.ndarray
@ -235,8 +263,6 @@ class Operator(TransportOperator):
# Update status
self.number.set_density(vec)
time_start = time.time()
# Update material compositions and tally nuclides
self._update_materials()
nuclides = self._get_tally_nuclides()
@ -245,10 +271,8 @@ class Operator(TransportOperator):
self._yield_helper.update_tally_nuclides(nuclides)
# Run OpenMC
openmc.capi.reset()
openmc.capi.run()
time_openmc = time.time()
openmc.lib.reset()
openmc.lib.run()
# Extract results
op_result = self._unpack_tallies_and_normalize(power)
@ -264,7 +288,7 @@ class Operator(TransportOperator):
step : int
Current depletion step including restarts
"""
openmc.capi.statepoint_write(
openmc.lib.statepoint_write(
"openmc_simulation_n{}.h5".format(step),
write_source=False)
@ -438,10 +462,10 @@ class Operator(TransportOperator):
# Initialize OpenMC library
comm.barrier()
openmc.capi.init(intracomm=comm)
openmc.lib.init(intracomm=comm)
# Generate tallies in memory
materials = [openmc.capi.materials[int(i)]
materials = [openmc.lib.materials[int(i)]
for i in self.burnable_mats]
self._rate_helper.generate_tallies(materials, self.chain.reactions)
self._energy_helper.prepare(
@ -456,7 +480,7 @@ class Operator(TransportOperator):
def finalize(self):
"""Finalize a depletion simulation and release resources."""
openmc.capi.finalize()
openmc.lib.finalize()
def _update_materials(self):
"""Updates material compositions in OpenMC on all processes."""
@ -491,7 +515,7 @@ class Operator(TransportOperator):
number_i[mat, nuc] = 0.0
# Update densities on C API side
mat_internal = openmc.capi.materials[int(mat)]
mat_internal = openmc.lib.materials[int(mat)]
mat_internal.set_densities(nuclides, densities)
#TODO Update densities on the Python side, otherwise the
@ -581,7 +605,7 @@ class Operator(TransportOperator):
rates.fill(0.0)
# Get k and uncertainty
k_combined = ufloat(*openmc.capi.keff())
k_combined = ufloat(*openmc.lib.keff())
# Extract tally bins
nuclides = self._rate_helper.nuclides
@ -634,6 +658,15 @@ class Operator(TransportOperator):
# J / s / source neutron
energy = comm.allreduce(self._energy_helper.energy)
# Guard against divide by zero
if energy == 0:
if comm.rank == 0:
sys.stderr.flush()
print(" No energy reported from OpenMC tallies. Do your HDF5 "
"files have heating data?\n", file=sys.stderr, flush=True)
comm.barrier()
comm.Abort(1)
# Scale reaction rates to obtain units of reactions/sec
rates *= power / energy

View file

@ -7,6 +7,9 @@ from collections import OrderedDict
import numpy as np
__all__ = ["ReactionRates"]
class ReactionRates(np.ndarray):
"""Reaction rates resulting from a transport operator call

View file

@ -16,6 +16,9 @@ from .reaction_rates import ReactionRates
_VERSION_RESULTS = (1, 0)
__all__ = ["Results"]
class Results(object):
"""Output of a depletion run

View file

@ -5,6 +5,9 @@ from .results import Results, _VERSION_RESULTS
from openmc.checkvalue import check_filetype_version
__all__ = ["ResultsList"]
class ResultsList(list):
"""A list of openmc.deplete.Results objects
@ -137,7 +140,7 @@ class ResultsList(list):
def get_depletion_time(self):
"""Return an array of the average time to deplete a material
..note::
.. note::
Will have one fewer row than number of other methods,
like :meth:`get_eigenvalues`, because no depletion
@ -145,7 +148,6 @@ class ResultsList(list):
Returns
-------
times : :class:`numpy.ndarray`
Vector of average time to deplete a single material
across all processes and materials.

View file

@ -1,14 +1,14 @@
"""
This module provides bindings to C functions defined by OpenMC shared library.
When the :mod:`openmc` package is imported, the OpenMC shared library is
automatically loaded. Calls to the OpenMC library can then be via functions or
objects in the :mod:`openmc.capi` subpackage, for example:
This module provides bindings to C/C++ functions defined by OpenMC shared
library. When the :mod:`openmc.lib` package is imported, the OpenMC shared
library is automatically loaded. Calls to the OpenMC library can then be via
functions or objects in :mod:`openmc.lib`, for example:
.. code-block:: python
openmc.capi.init()
openmc.capi.run()
openmc.capi.finalize()
openmc.lib.init()
openmc.lib.run()
openmc.lib.finalize()
"""
@ -33,7 +33,7 @@ if os.environ.get('READTHEDOCS', None) != 'True':
else:
# For documentation builds, we don't actually have the shared library
# available. Instead, we create a mock object so that when the modules
# within the openmc.capi package try to configure arguments and return
# within the openmc.lib package try to configure arguments and return
# values for symbols, no errors occur
from unittest.mock import Mock
_dll = Mock()

View file

@ -63,7 +63,7 @@ class Cell(_FortranObjectWithID):
This class exposes a cell that is stored internally in the OpenMC
library. To obtain a view of a cell with a given ID, use the
:data:`openmc.capi.cells` mapping.
:data:`openmc.lib.cells` mapping.
Parameters
----------

View file

@ -11,7 +11,7 @@ from numpy.ctypeslib import as_array
from openmc.exceptions import AllocationError
from . import _dll
from .error import _error_handler
import openmc.capi
import openmc.lib
class _Bank(Structure):
@ -127,7 +127,7 @@ def find_cell(xyz):
Returns
-------
openmc.capi.Cell
openmc.lib.Cell
Cell containing the point
int
If the cell at the given point is repeated in the geometry, this
@ -137,7 +137,7 @@ def find_cell(xyz):
index = c_int32()
instance = c_int32()
_dll.openmc_find_cell((c_double*3)(*xyz), index, instance)
return openmc.capi.Cell(index=index.value), instance.value
return openmc.lib.Cell(index=index.value), instance.value
def find_material(xyz):
@ -150,7 +150,7 @@ def find_material(xyz):
Returns
-------
openmc.capi.Material or None
openmc.lib.Material or None
Material containing the point, or None is no material is found
"""
@ -158,8 +158,8 @@ def find_material(xyz):
instance = c_int32()
_dll.openmc_find_cell((c_double*3)(*xyz), index, instance)
mats = openmc.capi.Cell(index=index.value).fill
if isinstance(mats, (openmc.capi.Material, type(None))):
mats = openmc.lib.Cell(index=index.value).fill
if isinstance(mats, (openmc.lib.Material, type(None))):
return mats
else:
return mats[instance.value]
@ -225,21 +225,21 @@ def iter_batches():
This function returns a generator-iterator that allows Python code to be run
between batches in an OpenMC simulation. It should be used in conjunction
with :func:`openmc.capi.simulation_init` and
:func:`openmc.capi.simulation_finalize`. For example:
with :func:`openmc.lib.simulation_init` and
:func:`openmc.lib.simulation_finalize`. For example:
.. code-block:: Python
with openmc.capi.run_in_memory():
openmc.capi.simulation_init()
for _ in openmc.capi.iter_batches():
with openmc.lib.run_in_memory():
openmc.lib.simulation_init()
for _ in openmc.lib.iter_batches():
# Look at convergence of tallies, for example
...
openmc.capi.simulation_finalize()
openmc.lib.simulation_finalize()
See Also
--------
openmc.capi.next_batch
openmc.lib.next_batch
"""
while True:
@ -365,11 +365,11 @@ def run_in_memory(**kwargs):
block, all memory that was allocated during the block is freed. For
example::
with openmc.capi.run_in_memory():
with openmc.lib.run_in_memory():
for i in range(n_iters):
openmc.capi.reset()
openmc.lib.reset()
do_stuff()
openmc.capi.run()
openmc.lib.run()
Parameters
----------

Some files were not shown because too many files have changed in this diff Show more