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

This commit is contained in:
rockfool 2020-02-05 20:16:53 -05:00
commit e74d6aa362
468 changed files with 12633 additions and 68362 deletions

108
.clang-format Normal file
View file

@ -0,0 +1,108 @@
---
Language: Cpp
# BasedOnStyle: Mozilla
AccessModifierOffset: -2
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...

12
.gitmodules vendored
View file

@ -0,0 +1,12 @@
[submodule "vendor/pugixml"]
path = vendor/pugixml
url = https://github.com/zeux/pugixml.git
[submodule "vendor/gsl-lite"]
path = vendor/gsl-lite
url = https://github.com/martinmoene/gsl-lite.git
[submodule "vendor/xtensor"]
path = vendor/xtensor
url = https://github.com/xtensor-stack/xtensor.git
[submodule "vendor/xtl"]
path = vendor/xtl
url = https://github.com/xtensor-stack/xtl.git

View file

@ -45,6 +45,8 @@ matrix:
env: OMP=n MPI=y PHDF5=y
- python: "3.7"
env: OMP=y MPI=y PHDF5=y DAGMC=y
- python: "3.7"
env: OMP=y MPI=n PHDF5=n EVENT=y
notifications:
webhooks: https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN
install:

View file

@ -109,12 +109,36 @@ message(STATUS "OpenMC Linker flags: ${ldflags}")
endif()
#===============================================================================
# Update git submodules as needed
#===============================================================================
find_package(Git)
if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL 0)
message(FATAL_ERROR "git submodule update --init failed with \
${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()
# Check to see if submodules exist (by checking one)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/vendor/pugixml/CMakeLists.txt")
message(FATAL_ERROR "The git submodules were not downloaded! GIT_SUBMODULE was \
turned off or failed. Please update submodules and try again.")
endif()
#===============================================================================
# pugixml library
#===============================================================================
add_library(pugixml vendor/pugixml/pugixml.cpp)
target_include_directories(pugixml PUBLIC vendor/pugixml/)
add_subdirectory(vendor/pugixml)
#===============================================================================
# xtensor header-only library
@ -126,6 +150,7 @@ if (NOT (CMAKE_VERSION VERSION_LESS 3.13))
endif()
add_subdirectory(vendor/xtl)
set(xtl_DIR ${CMAKE_CURRENT_BINARY_DIR}/vendor/xtl)
add_subdirectory(vendor/xtensor)
target_link_libraries(xtensor INTERFACE xtl)
@ -133,16 +158,18 @@ target_link_libraries(xtensor INTERFACE xtl)
# GSL header-only library
#===============================================================================
add_library(gsl INTERFACE)
target_include_directories(gsl INTERFACE vendor/gsl/include)
add_subdirectory(vendor/gsl-lite)
# Make sure contract violations throw exceptions
target_compile_definitions(gsl INTERFACE GSL_THROW_ON_CONTRACT_VIOLATION)
target_compile_definitions(gsl-lite INTERFACE GSL_THROW_ON_CONTRACT_VIOLATION)
#===============================================================================
# RPATH information
#===============================================================================
# Provide install directory variables as defined by GNU coding standards
include(GNUInstallDirs)
# This block of code ensures that dynamic libraries can be found via the RPATH
# whether the executable is the original one from the build directory or the
# installed one in CMAKE_INSTALL_PREFIX. Ref:
@ -155,16 +182,14 @@ set(CMAKE_SKIP_BUILD_RPATH FALSE)
# (but later on when installing)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# the RPATH to be used when installing, but only if it's not a system directory
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_FULL_LIBDIR}" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
endif()
#===============================================================================
@ -172,7 +197,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})
#===============================================================================
@ -194,6 +223,7 @@ list(APPEND libopenmc_SOURCES
src/eigenvalue.cpp
src/endf.cpp
src/error.cpp
src/event.cpp
src/initialize.cpp
src/finalize.cpp
src/geometry.cpp
@ -239,6 +269,7 @@ list(APPEND libopenmc_SOURCES
src/tallies/filter_cellborn.cpp
src/tallies/filter_cellfrom.cpp
src/tallies/filter_cell.cpp
src/tallies/filter_cell_instance.cpp
src/tallies/filter_delayedgroup.cpp
src/tallies/filter_distribcell.cpp
src/tallies/filter_energyfunc.cpp
@ -283,7 +314,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})
@ -296,19 +331,21 @@ if (MPI_ENABLED)
endif()
# Set git SHA1 hash as a compile definition
execute_process(COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SHA1_SUCCESS
OUTPUT_VARIABLE GIT_SHA1
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(GIT_SHA1_SUCCESS EQUAL 0)
target_compile_definitions(libopenmc PRIVATE -DGIT_SHA1="${GIT_SHA1}")
if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SHA1_SUCCESS
OUTPUT_VARIABLE GIT_SHA1
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(GIT_SHA1_SUCCESS EQUAL 0)
target_compile_definitions(libopenmc PRIVATE -DGIT_SHA1="${GIT_SHA1}")
endif()
endif()
# target_link_libraries treats any arguments starting with - but not -l as
# linker flags. Thus, we can pass both linker flags and libraries together.
target_link_libraries(libopenmc ${ldflags} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES}
pugixml faddeeva xtensor gsl)
pugixml faddeeva xtensor gsl-lite)
if(dagmc)
target_compile_definitions(libopenmc PRIVATE DAGMC)
@ -343,12 +380,24 @@ add_custom_command(TARGET libopenmc POST_BUILD
# 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)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/OpenMC)
install(TARGETS openmc libopenmc faddeeva
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 all except faddeeva are handled
# separately since they are managed by CMake)
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

@ -30,7 +30,7 @@ RUN git clone https://github.com/njoy/NJOY2016 /opt/NJOY2016 && \
# Clone and install OpenMC
RUN git clone https://github.com/openmc-dev/openmc.git /opt/openmc && \
cd /opt/openmc && mkdir -p build && cd build && \
cmake -Doptimize=on -DHDF5_PREFER_PARALLEL=on .. && \
cmake -Doptimize=on -DHDF5_PREFER_PARALLEL=on .. && \
make && make install && \
cd .. && pip install -e .[test]

View file

@ -1,4 +1,4 @@
Copyright (c) 2011-2018 Massachusetts Institute of Technology and OpenMC contributors
Copyright (c) 2011-2020 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()

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

@ -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)
@ -72,16 +72,16 @@ master_doc = 'index'
# General information about the project.
project = 'OpenMC'
copyright = '2011-2019, Massachusetts Institute of Technology and OpenMC contributors'
copyright = '2011-2020, Massachusetts Institute of Technology and OpenMC contributors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# 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

@ -12,6 +12,14 @@ adding new code in OpenMC.
C++
---
.. important:: To ensure consistent styling with little effort, this project
uses `clang-format <https://clang.llvm.org/docs/ClangFormat.html>`_. The
repository contains a ``.clang-format`` file that can be used to
automatically apply the style rules that are described below. The easiest
way to use clang-format is through a plugin/extension for your editor/IDE
that automatically runs clang-format using the ``.clang-format`` file
whenever a file is saved.
Indentation
-----------
@ -207,8 +215,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 +239,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

@ -63,7 +63,7 @@ features and bug fixes. The general steps for contributing are as follows:
.. code-block:: sh
git clone git@github.com:yourusername/openmc.git
git clone --recurse-submodules git@github.com:yourusername/openmc.git
cd openmc
git checkout -b newbranch develop
@ -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

@ -96,6 +96,17 @@ When the DAGMC mode is enabled, the OpenMC geometry will be read from the file
``dagmc.h5m``. If a :ref:`geometry.xml <io_geometry>` file is present with
``dagmc`` set to ``true``, it will be ignored.
----------------------------
``<delayed_photon_scaling>``
----------------------------
Determines whether to scale the fission photon yield to account for delayed
photon energy. The photon yields are scaled as (EGP + EGD)/EGP where EGP and EGD
are the prompt and delayed photon components of energy release, respectively,
from MF=1, MT=458 on an ENDF evaluation.
*Default*: true
--------------------------------
``<electron_treatment>`` Element
--------------------------------
@ -126,6 +137,15 @@ The ``<entropy_mesh>`` element indicates the ID of a mesh that is to be used for
calculating Shannon entropy. The mesh should cover all possible fissionable
materials in the problem and is specified using a :ref:`mesh_element`.
----------------------------
``<event_based>``
----------------------------
Determines whether to use event-based parallelism instead of the default
history-based parallelism.
*Default*: false
-----------------------------------
``<generations_per_batch>`` Element
-----------------------------------
@ -195,6 +215,28 @@ based on the recommended value in LA-UR-14-24530_.
.. _LA-UR-14-24530: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-14-24530.pdf
---------------------------
``<material_cell_offsets>``
---------------------------
By default, OpenMC will count the number of instances of each cell filled with a
material and generate "offset tables" that are used for cell instance tallies.
The ``<material_cell_offsets>`` element allows a user to override this default
setting and turn off the generation of offset tables, if desired, by setting it
to false.
*Default*: true
----------------------------------------
``<max_particles_in_flight>`` Element
----------------------------------------
This element indicates the number of neutrons to run in flight concurrently
when using event-based parallelism. A higher value uses more memory, but
may be more efficient computationally.
*Default*: 100000
---------------------------
``<max_order>`` Element
---------------------------
@ -333,7 +375,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"
@ -423,12 +465,19 @@ attributes/sub-elements:
:type:
The type of spatial distribution. Valid options are "box", "fission",
"point", and "cartesian". A "box" spatial distribution has coordinates
sampled uniformly in a parallelepiped. A "fission" spatial distribution
samples locations from a "box" distribution but only locations in
fissionable materials are accepted. A "point" spatial distribution has
coordinates specified by a triplet. An "cartesian" spatial distribution
specifies independent distributions of x-, y-, and z-coordinates.
"point", "cartesian", "cylindrical", and "spherical". A "box" spatial
distribution has coordinates sampled uniformly in a parallelepiped. A
"fission" spatial distribution samples locations from a "box"
distribution but only locations in fissionable materials are accepted.
A "point" spatial distribution has coordinates specified by a triplet.
A "cartesian" spatial distribution specifies independent distributions of
x-, y-, and z-coordinates. A "cylindrical" spatial distribution specifies
independent distributions of r-, phi-, and z-coordinates where phi is the
azimuthal angle and the origin for the cylindrical coordinate system is
specified by origin. A "spherical" spatial distribution specifies
independent distributions of r-, theta-, and phi-coordinates where theta
is the angle with respect to the z-axis, phi is the azimuthal angle, and
the sphere is centered on the coordinate (x0,y0,z0).
*Default*: None
@ -446,6 +495,12 @@ attributes/sub-elements:
For an "cartesian" distribution, no parameters are specified. Instead,
the ``x``, ``y``, and ``z`` elements must be specified.
For a "cylindrical" distribution, no parameters are specified. Instead,
the ``r``, ``phi``, ``z``, and ``origin`` elements must be specified.
For a "spherical" distribution, no parameters are specified. Instead,
the ``r``, ``theta``, ``phi``, and ``origin`` elements must be specified.
*Default*: None
:x:
@ -461,11 +516,34 @@ attributes/sub-elements:
:ref:`univariate`).
:z:
For an "cartesian" distribution, this element specifies the distribution
of z-coordinates. The necessary sub-elements/attributes are those of a
For both "cartesian" and "cylindrical" distributions, this element
specifies the distribution of z-coordinates. The necessary
sub-elements/attributes are those of a univariate probability
distribution (see the description in :ref:`univariate`).
:r:
For "cylindrical" and "spherical" distributions, this element specifies
the distribution of r-coordinates (cylindrical radius and spherical
radius, respectively). The necessary sub-elements/attributes are those
of a univariate probability distribution (see the description in
:ref:`univariate`).
:theta:
For a "spherical" distribution, this element specifies the distribution
of theta-coordinates. The necessary sub-elements/attributes are those of a
univariate probability distribution (see the description in
:ref:`univariate`).
:phi:
For "cylindrical" and "spherical" distributions, this element specifies
the distribution of phi-coordinates. The necessary
sub-elements/attributes are those of a univariate probability
distribution (see the description in :ref:`univariate`).
:origin:
For "cylindrical and "spherical" distributions, this element specifies
the coordinates for the origin of the coordinate system.
:angle:
An element specifying the angular distribution of source sites. This element
has the following attributes:

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

@ -4,7 +4,7 @@
License Agreement
=================
Copyright © 2011-2019 Massachusetts Institute of Technology and OpenMC contributors
Copyright © 2011-2020 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

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

@ -358,9 +358,9 @@ secondary energy and angle sampling.
For a reaction with secondary products, it is necessary to determine the
outgoing angle and energy of the products. For any reaction other than elastic
and level inelastic scattering, the outgoing energy must be determined based on
tabulated or parameterized data. The `ENDF-6 Format`_ specifies a variety of
ways that the secondary energy distribution can be represented. ENDF File 5
contains uncorrelated energy distribution whereas ENDF File 6 contains
tabulated or parameterized data. The `ENDF-6 Format <endf102>`_ specifies a
variety of ways that the secondary energy distribution can be represented. ENDF
File 5 contains uncorrelated energy distribution whereas ENDF File 6 contains
correlated energy-angle distributions. The ACE format specifies its own
representations based loosely on the formats given in ENDF-6. OpenMC's HDF5
nuclear data files use a combination of ENDF and ACE distributions; in this
@ -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:
@ -1358,23 +1357,29 @@ Calculating Integrated Cross Sections
The first aspect of using |sab| tables is calculating cross sections to replace
the data that would normally appear on the incident neutron data, which do not
account for thermal binding effects. For incoherent elastic and inelastic
scattering, the cross sections are stored as linearly interpolable functions on
a specified energy grid. For coherent elastic data, the cross section can be
expressed as
account for thermal binding effects. For incoherent inelastic scattering, the
cross section is stored as a linearly interpolable function on a specified
energy grid. For coherent elastic data, the cross section can be expressed as
.. math::
:label: coherent-elastic-xs
\sigma(E) = \frac{\sigma_c}{E} \sum_{E_i < E} f_i e^{-4WE_i}
\sigma(E) = \frac{1}{E} \sum_{E_i < E} s_i
where :math:`\sigma_c` is the effective bound coherent scattering cross section,
:math:`W` is the effective Debye-Waller coefficient, :math:`E_i` are the
energies of the Bragg edges, and :math:`f_i` are related to crystallographic
structure factors. Since the functional form of the cross section is just 1/E
and the proportionality constant changes only at Bragg edges, the
proportionality constants are stored and then the cross section can be
calculated analytically based on equation :eq:`coherent-elastic-xs`.
where :math:`E_i` are the energies of the Bragg edges and :math:`s_i` are
related to crystallographic structure factors. Since the functional form of the
cross section is just 1/E and the proportionality constant changes only at Bragg
edges, the proportionality constants are stored and then the cross section can
be calculated analytically based on equation :eq:`coherent-elastic-xs`. For
incoherent elastic data, the cross section can be expressed as
.. math::
:label: incoherent-elastic-xs
\sigma(E) = \frac{\sigma_b}{2} \left( \frac{1 - e^{-4EW'}}{2EW'} \right)
where :math:`\sigma_b` is the characteristic bound cross section and :math:`W'`
is the Debye-Waller integral divided by the atomic mass.
Outgoing Angle for Coherent Elastic Scattering
----------------------------------------------
@ -1389,7 +1394,7 @@ scatter then neutron is given by
.. math::
:label: coherent-elastic-probability
\frac{f_i e^{-4WE_i}}{\sum_j f_j e^{-4WE_j}}.
\frac{s_i}{\sum_j s_j}.
After a Bragg edge has been sampled, the cosine of the angle of scattering is
given analytically by
@ -1401,20 +1406,35 @@ given analytically by
where :math:`E_i` is the energy of the Bragg edge that scattered the neutron.
.. _incoherent elastic angle:
Outgoing Angle for Incoherent Elastic Scattering
------------------------------------------------
For incoherent elastic scattering, the probability distribution for the cosine
of the angle of scattering is represent as a series of equally-likely discrete
For incoherent elastic scattering, OpenMC has two methods for calculating the
cosine of the angle of scattering. The first method uses the Debye-Waller
integral, :math:`W'`, and the characteristic bound cross section as given
directly in an ENDF-6 formatted file. In this case, the cosine of the angle of
scattering can be sampled by inverting equation 7.4 from the `ENDF-6 Format
Manual <endf102>`_:
.. math::
:label: incoherent-elastic-mu-exact
\mu = \frac{1}{c} \log \left( 1 + \xi \left( e^{2c} - 1 \right) \right) - 1
where :math:`\xi` is a random number sampled on unit interval and :math:`c =
2EW'`. In the second method, the probability distribution for the cosine of the
angle of scattering is represented as a series of equally-likely discrete
cosines :math:`\mu_{i,j}` for each incoming energy :math:`E_i` on the thermal
elastic energy grid. First the outgoing angle bin :math:`j` is sampled. Then, if
the incoming energy of the neutron satisfies :math:`E_i < E < E_{i+1}` the final
cosine is
the incoming energy of the neutron satisfies :math:`E_i < E < E_{i+1}` the
cosine of the angle of scattering is
.. math::
:label: incoherent-elastic-angle
\mu = \mu_{i,j} + f (\mu_{i+1,j} - \mu_{i,j})
\mu' = \mu_{i,j} + f (\mu_{i+1,j} - \mu_{i,j})
where the interpolation factor is defined as
@ -1423,6 +1443,30 @@ where the interpolation factor is defined as
f = \frac{E - E_i}{E_{i+1} - E_i}.
To better represent the true, continuous nature of the cosine distribution, the
sampled value of :math:`mu'` is then "smeared" based on the neighboring values.
First, values of :math:`\mu` are calculated for outgoing angle bins :math:`j-1`
and :math:`j+1`:
.. math::
:label: incoherent-elastic-smear1
\mu_\text{left} = \mu_{i,j-1} + f (\mu_{i+1,j-1} - \mu_{i,j-1}) \\
\mu_\text{right} = \mu_{i,j+1} + f (\mu_{i+1,j+1} - \mu_{i,j+1}).
Then, a final cosine is calculated as:
.. math::
:label: incoherent-elastic-smear2
\mu = \mu' + \min (\mu - \mu_\text{left}, \mu + \mu_\text{right} ) \cdot
\left( \xi - \frac{1}{2} \right)
where :math:`\xi` is again a random number sampled on the unit interval. Care
must be taken to ensure that :math:`\mu` does not fall outside the interval
:math:`[-1,1]`.
Outgoing Energy and Angle for Inelastic Scattering
--------------------------------------------------
@ -1493,7 +1537,10 @@ which angular distribution data to use. Like the linear-linear interpolation
case in Law 61, the angular distribution closest to the sampled value of the
cumulative distribution function for the outgoing energy is utilized. The
actual algorithm utilized to sample the outgoing angle is shown in equation
:eq:`inelastic-angle`.
:eq:`inelastic-angle`. As in the case of incoherent elastic scattering with
discrete cosine bins, the sampled cosine is :ref:`smeared <incoherent elastic
angle>` over neighboring angle bins to better approximate a continuous
distribution.
.. _probability_tables:
@ -1645,23 +1692,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
.. _endf102: 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 +1716,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

@ -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

@ -71,6 +71,10 @@ Coupling and Multi-physics
Coupling of OpenMC and Nek5000 within the MOOSE Framework," *Proc. PHYSOR*,
Cancun, Mexico, Apr. 22-26 (2018).
- Sterling Harper, Kord Smith, and Benoit Forget, "Faster Monte Carlo
multiphysics using temperature derivatives," *Proc. PHYSOR*, Cancun, Mexico,
Apr. 22-26 (2018).
- Jun Chen, Liangzhi Cao, Chuanqi Zhao, and Zhouyu Liu, "`Development of
Subchannel Code SUBSC for high-fidelity multi-physics coupling application
<https://doi.org/10.1016/j.egypro.2017.08.121>`_", *Energy Procedia*, **127**,
@ -142,6 +146,11 @@ Geometry and Visualization
Miscellaneous
-------------
- Govatsa Acharya, "`Investigating the Application of Self-Actuated Passive
Shutdown System in a Small Lead-Cooled Reactor
<https://doi.org/10.13140/RG.2.2.26088.01281>`_," M.S. Thesis, KTH Royal
Institute of Technology (2019).
- 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).
@ -366,7 +375,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.
@ -409,7 +418,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.

View file

@ -107,6 +107,7 @@ Constructing Tallies
openmc.CellFilter
openmc.CellFromFilter
openmc.CellbornFilter
openmc.CellInstanceFilter
openmc.SurfaceFilter
openmc.MeshFilter
openmc.MeshSurfaceFilter

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,9 @@ Classes
:nosignatures:
:template: myclass.rst
openmc.data.ace.Library
openmc.data.ace.Table
ace.Library
ace.Table
ace.TableType
Functions
+++++++++
@ -155,7 +158,9 @@ Functions
:nosignatures:
:template: myfunction.rst
openmc.data.ace.ascii_to_binary
ace.ascii_to_binary
ace.get_libraries_from_xsdir
ace.get_libraries_from_xsdata
ENDF Format
-----------
@ -168,7 +173,7 @@ Classes
:nosignatures:
:template: myclass.rst
openmc.data.endf.Evaluation
endf.Evaluation
Functions
+++++++++
@ -178,13 +183,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 +199,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

@ -46,5 +46,7 @@ Spatial Distributions
openmc.stats.Spatial
openmc.stats.CartesianIndependent
openmc.stats.CylindricalIndependent
openmc.stats.SphericalIndependent
openmc.stats.Box
openmc.stats.Point

View file

@ -109,7 +109,7 @@ commands in a terminal:
.. code-block:: sh
git clone https://github.com/openmc-dev/openmc.git
git clone --recurse-submodules https://github.com/openmc-dev/openmc.git
cd openmc
mkdir build && cd build
cmake ..

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
-------
@ -40,6 +35,7 @@ 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
@ -47,7 +43,8 @@ New Features
- 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:
@ -88,6 +85,7 @@ Python API Changes
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>`_
@ -106,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>`_
@ -123,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,94 @@ 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. The volume of the original ``fuel_3`` material must represent
the volume of **all** the ``fuel_3`` in the problem. When creating the unique
materials, this volume will be equally distributed across all material instances.
.. 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:
@ -178,7 +179,7 @@ with GitHub since this involves setting up ssh_ keys. With git installed and
setup, the following command will download the full source code from the GitHub
repository::
git clone https://github.com/openmc-dev/openmc.git
git clone --recurse-submodules https://github.com/openmc-dev/openmc.git
By default, the cloned repository will be set to the development branch. To
switch to the source of the latest stable release, run the following commands::
@ -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

@ -33,6 +33,7 @@ working directory which may be different from
flags:
-c, --volume Run in stochastic volume calculation mode
-e, --event Run using event-based parallelism
-g, --geometry-debug Run in geometry debugging mode, where cell overlaps are
checked for after each move of a particle
-n, --particles N Use *N* particles per generation or batch

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,12 +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. |
| |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 @@
../../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

@ -1,6 +1,8 @@
#ifndef OPENMC_ANGLE_ENERGY_H
#define OPENMC_ANGLE_ENERGY_H
#include <cstdint>
namespace openmc {
//==============================================================================
@ -12,7 +14,8 @@ namespace openmc {
class AngleEnergy {
public:
virtual void sample(double E_in, double& E_out, double& mu) const = 0;
virtual void sample(double E_in, double& E_out, double& mu,
uint64_t* seed) const = 0;
virtual ~AngleEnergy() = default;
};

View file

@ -4,14 +4,10 @@
#include <cstdint>
#include <vector>
#include "openmc/shared_array.h"
#include "openmc/particle.h"
#include "openmc/position.h"
// Without an explicit instantiation of vector<Bank>, the Intel compiler
// will complain about the threadprivate directive on filter_matches. Note that
// this has to happen *outside* of the openmc namespace
extern template class std::vector<openmc::Particle::Bank>;
namespace openmc {
//==============================================================================
@ -21,13 +17,10 @@ namespace openmc {
namespace simulation {
extern std::vector<Particle::Bank> source_bank;
extern std::vector<Particle::Bank> fission_bank;
extern std::vector<Particle::Bank> secondary_bank;
#ifdef _OPENMP
extern std::vector<Particle::Bank> master_fission_bank;
#endif
#pragma omp threadprivate(fission_bank, secondary_bank)
extern SharedArray<Particle::Bank> fission_bank;
extern std::vector<int64_t> progeny_per_particle;
} // namespace simulation
@ -35,8 +28,12 @@ extern std::vector<Particle::Bank> master_fission_bank;
// Non-member functions
//==============================================================================
void sort_fission_bank();
void free_memory_bank();
void init_fission_bank(int64_t max);
} // namespace openmc
#endif // OPENMC_BANK_H

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);
@ -138,7 +140,7 @@ extern "C" {
const int* indices, int n_elements,
int dim, double spectral,
const int* cmfd_indices,
const int* map);
const int* map, bool use_all_threads);
//! Runs a Gauss Seidel linear solver to solve CMFD matrix equations
//! linear solver

View file

@ -2,12 +2,14 @@
#define OPENMC_CELL_H
#include <cstdint>
#include <functional> // for hash
#include <limits>
#include <memory> // for unique_ptr
#include <string>
#include <unordered_map>
#include <vector>
#include <gsl/gsl>
#include "hdf5.h"
#include "pugixml.hpp"
#include "dagmc.h"
@ -23,10 +25,11 @@ namespace openmc {
// Constants
//==============================================================================
// TODO: Convert to enum
constexpr int FILL_MATERIAL {1};
constexpr int FILL_UNIVERSE {2};
constexpr int FILL_LATTICE {3};
enum class Fill {
MATERIAL,
UNIVERSE,
LATTICE
};
// TODO: Convert to enum
constexpr int32_t OP_LEFT_PAREN {std::numeric_limits<int32_t>::max()};
@ -110,7 +113,7 @@ public:
//! Find the oncoming boundary of this cell.
virtual std::pair<double, int32_t>
distance(Position r, Direction u, int32_t on_surface) const = 0;
distance(Position r, Direction u, int32_t on_surface, Particle* p) const = 0;
//! Write all information needed to reconstruct the cell to an HDF5 group.
//! \param group_id An HDF5 group id.
@ -147,7 +150,7 @@ public:
int32_t id_; //!< Unique ID
std::string name_; //!< User-defined name
int type_; //!< Material, universe, or lattice
Fill type_; //!< Material, universe, or lattice
int32_t universe_; //!< Universe # this cell is in
int32_t fill_; //!< Universe # filling this cell
int32_t n_instances_{0}; //!< Number of instances of this cell
@ -179,10 +182,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
@ -201,7 +204,7 @@ public:
contains(Position r, Direction u, int32_t on_surface) const;
std::pair<double, int32_t>
distance(Position r, Direction u, int32_t on_surface) const;
distance(Position r, Direction u, int32_t on_surface, Particle* p) const;
void to_hdf5(hid_t group_id) const;
@ -245,7 +248,7 @@ public:
bool contains(Position r, Direction u, int32_t on_surface) const;
std::pair<double, int32_t>
distance(Position r, Direction u, int32_t on_surface) const;
distance(Position r, Direction u, int32_t on_surface, Particle* p) const;
BoundingBox bounding_box() const;
@ -286,6 +289,26 @@ private:
std::vector<std::vector<int32_t>> partitions_;
};
//==============================================================================
//! Define an instance of a particular cell
//==============================================================================
struct CellInstance {
//! Check for equality
bool operator==(const CellInstance& other) const
{ return index_cell == other.index_cell && instance == other.instance; }
gsl::index index_cell;
gsl::index instance;
};
struct CellInstanceHash {
std::size_t operator()(const CellInstance& k) const
{
return 4096*k.index_cell + k.instance;
}
};
//==============================================================================
// Non-member functions
//==============================================================================

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};
@ -113,192 +113,170 @@ constexpr int NUCLIDE_NONE {-1};
// ============================================================================
// CROSS SECTION RELATED CONSTANTS
// Angular distribution type
// TODO: Convert to enum
constexpr int ANGLE_ISOTROPIC {1};
constexpr int ANGLE_32_EQUI {2};
constexpr int ANGLE_TABULAR {3};
constexpr int ANGLE_LEGENDRE {4};
constexpr int ANGLE_HISTOGRAM {5};
// Temperature treatment method
// TODO: Convert to enum?
constexpr int TEMPERATURE_NEAREST {1};
constexpr int TEMPERATURE_INTERPOLATION {2};
enum class TemperatureMethod {
NEAREST,
INTERPOLATION
};
// Reaction types
// TODO: Convert to enum
constexpr int REACTION_NONE {0};
constexpr int TOTAL_XS {1};
constexpr int ELASTIC {2};
constexpr int N_NONELASTIC {3};
constexpr int N_LEVEL {4};
constexpr int MISC {5};
constexpr int N_2ND {11};
constexpr int N_2N {16};
constexpr int N_3N {17};
constexpr int N_FISSION {18};
constexpr int N_F {19};
constexpr int N_NF {20};
constexpr int N_2NF {21};
constexpr int N_NA {22};
constexpr int N_N3A {23};
constexpr int N_2NA {24};
constexpr int N_3NA {25};
constexpr int N_NP {28};
constexpr int N_N2A {29};
constexpr int N_2N2A {30};
constexpr int N_ND {32};
constexpr int N_NT {33};
constexpr int N_N3HE {34};
constexpr int N_ND2A {35};
constexpr int N_NT2A {36};
constexpr int N_4N {37};
constexpr int N_3NF {38};
constexpr int N_2NP {41};
constexpr int N_3NP {42};
constexpr int N_N2P {44};
constexpr int N_NPA {45};
constexpr int N_N1 {51};
constexpr int N_N40 {90};
constexpr int N_NC {91};
constexpr int N_DISAPPEAR {101};
constexpr int N_GAMMA {102};
constexpr int N_P {103};
constexpr int N_D {104};
constexpr int N_T {105};
constexpr int N_3HE {106};
constexpr int N_A {107};
constexpr int N_2A {108};
constexpr int N_3A {109};
constexpr int N_2P {111};
constexpr int N_PA {112};
constexpr int N_T2A {113};
constexpr int N_D2A {114};
constexpr int N_PD {115};
constexpr int N_PT {116};
constexpr int N_DA {117};
constexpr int N_5N {152};
constexpr int N_6N {153};
constexpr int N_2NT {154};
constexpr int N_TA {155};
constexpr int N_4NP {156};
constexpr int N_3ND {157};
constexpr int N_NDA {158};
constexpr int N_2NPA {159};
constexpr int N_7N {160};
constexpr int N_8N {161};
constexpr int N_5NP {162};
constexpr int N_6NP {163};
constexpr int N_7NP {164};
constexpr int N_4NA {165};
constexpr int N_5NA {166};
constexpr int N_6NA {167};
constexpr int N_7NA {168};
constexpr int N_4ND {169};
constexpr int N_5ND {170};
constexpr int N_6ND {171};
constexpr int N_3NT {172};
constexpr int N_4NT {173};
constexpr int N_5NT {174};
constexpr int N_6NT {175};
constexpr int N_2N3HE {176};
constexpr int N_3N3HE {177};
constexpr int N_4N3HE {178};
constexpr int N_3N2P {179};
constexpr int N_3N3A {180};
constexpr int N_3NPA {181};
constexpr int N_DT {182};
constexpr int N_NPD {183};
constexpr int N_NPT {184};
constexpr int N_NDT {185};
constexpr int N_NP3HE {186};
constexpr int N_ND3HE {187};
constexpr int N_NT3HE {188};
constexpr int N_NTA {189};
constexpr int N_2N2P {190};
constexpr int N_P3HE {191};
constexpr int N_D3HE {192};
constexpr int N_3HEA {193};
constexpr int N_4N2P {194};
constexpr int N_4N2A {195};
constexpr int N_4NPA {196};
constexpr int N_3P {197};
constexpr int N_N3P {198};
constexpr int N_3N2PA {199};
constexpr int N_5N2P {200};
constexpr int N_XP {203};
constexpr int N_XD {204};
constexpr int N_XT {205};
constexpr int N_X3HE {206};
constexpr int N_XA {207};
constexpr int HEATING {301};
constexpr int DAMAGE_ENERGY {444};
constexpr int COHERENT {502};
constexpr int INCOHERENT {504};
constexpr int PAIR_PROD_ELEC {515};
constexpr int PAIR_PROD {516};
constexpr int PAIR_PROD_NUC {517};
constexpr int PHOTOELECTRIC {522};
constexpr int N_P0 {600};
constexpr int N_PC {649};
constexpr int N_D0 {650};
constexpr int N_DC {699};
constexpr int N_T0 {700};
constexpr int N_TC {749};
constexpr int N_3HE0 {750};
constexpr int N_3HEC {799};
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};
enum ReactionType {
REACTION_NONE = 0,
TOTAL_XS = 1,
ELASTIC = 2,
N_NONELASTIC = 3,
N_LEVEL = 4,
MISC = 5,
N_2ND = 11,
N_2N = 16,
N_3N = 17,
N_FISSION = 18,
N_F = 19,
N_NF = 20,
N_2NF = 21,
N_NA = 22,
N_N3A = 23,
N_2NA = 24,
N_3NA = 25,
N_NP = 28,
N_N2A = 29,
N_2N2A = 30,
N_ND = 32,
N_NT = 33,
N_N3HE = 34,
N_ND2A = 35,
N_NT2A = 36,
N_4N = 37,
N_3NF = 38,
N_2NP = 41,
N_3NP = 42,
N_N2P = 44,
N_NPA = 45,
N_N1 = 51,
N_N40 = 90,
N_NC = 91,
N_DISAPPEAR = 101,
N_GAMMA = 102,
N_P = 103,
N_D = 104,
N_T = 105,
N_3HE = 106,
N_A = 107,
N_2A = 108,
N_3A = 109,
N_2P = 111,
N_PA = 112,
N_T2A = 113,
N_D2A = 114,
N_PD = 115,
N_PT = 116,
N_DA = 117,
N_5N = 152,
N_6N = 153,
N_2NT = 154,
N_TA = 155,
N_4NP = 156,
N_3ND = 157,
N_NDA = 158,
N_2NPA = 159,
N_7N = 160,
N_8N = 161,
N_5NP = 162,
N_6NP = 163,
N_7NP = 164,
N_4NA = 165,
N_5NA = 166,
N_6NA = 167,
N_7NA = 168,
N_4ND = 169,
N_5ND = 170,
N_6ND = 171,
N_3NT = 172,
N_4NT = 173,
N_5NT = 174,
N_6NT = 175,
N_2N3HE = 176,
N_3N3HE = 177,
N_4N3HE = 178,
N_3N2P = 179,
N_3N3A = 180,
N_3NPA = 181,
N_DT = 182,
N_NPD = 183,
N_NPT = 184,
N_NDT = 185,
N_NP3HE = 186,
N_ND3HE = 187,
N_NT3HE = 188,
N_NTA = 189,
N_2N2P = 190,
N_P3HE = 191,
N_D3HE = 192,
N_3HEA = 193,
N_4N2P = 194,
N_4N2A = 195,
N_4NPA = 196,
N_3P = 197,
N_N3P = 198,
N_3N2PA = 199,
N_5N2P = 200,
N_XP = 203,
N_XD = 204,
N_XT = 205,
N_X3HE = 206,
N_XA = 207,
HEATING = 301,
DAMAGE_ENERGY = 444,
COHERENT = 502,
INCOHERENT = 504,
PAIR_PROD_ELEC = 515,
PAIR_PROD = 516,
PAIR_PROD_NUC = 517,
PHOTOELECTRIC = 522,
N_P0 = 600,
N_PC = 649,
N_D0 = 650,
N_DC = 699,
N_T0 = 700,
N_TC = 749,
N_3HE0 = 750,
N_3HEC = 799,
N_A0 = 800,
N_AC = 849,
N_2N0 = 875,
N_2NC = 891,
HEATING_LOCAL = 901
};
constexpr std::array<int, 6> DEPLETION_RX {N_GAMMA, N_P, N_A, N_2N, N_3N, N_4N};
// Fission neutron emission (nu) type
constexpr int NU_NONE {0}; // No nu values (non-fissionable)
constexpr int NU_POLYNOMIAL {1}; // Nu values given by polynomial
constexpr int NU_TABULAR {2}; // Nu values given by tabular distribution
// Library types
constexpr int LIBRARY_NEUTRON {1};
constexpr int LIBRARY_THERMAL {2};
constexpr int LIBRARY_PHOTON {3};
constexpr int LIBRARY_MULTIGROUP {4};
// Probability table parameters
constexpr int URR_CUM_PROB {0};
constexpr int URR_TOTAL {1};
constexpr int URR_ELASTIC {2};
constexpr int URR_FISSION {3};
constexpr int URR_N_GAMMA {4};
constexpr int URR_HEATING {5};
enum class URRTableParam {
CUM_PROB,
TOTAL,
ELASTIC,
FISSION,
N_GAMMA,
HEATING
};
// Maximum number of partial fission reactions
constexpr int PARTIAL_FISSION_MAX {4};
// Resonance elastic scattering methods
// TODO: Convert to enum
enum class ResScatMethod {
rvs, // Relative velocity sampling
dbrc, // Doppler broadening rejection correction
cxs // Constant cross section
};
// Electron treatments
// TODO: Convert to enum
constexpr int ELECTRON_LED {1}; // Local Energy Deposition
constexpr int ELECTRON_TTB {2}; // Thick Target Bremsstrahlung
enum class ElectronTreatment {
LED, // Local Energy Deposition
TTB // Thick Target Bremsstrahlung
};
// ============================================================================
// MULTIGROUP RELATED
// MGXS Table Types
// TODO: Convert to enum
constexpr int MGXS_ISOTROPIC {1}; // Isotroically weighted data
constexpr int MGXS_ANGLE {2}; // Data by angular bins
// Flag to denote this was a macroscopic data object
constexpr double MACROSCOPIC_AWR {-2.};
@ -306,103 +284,86 @@ constexpr double MACROSCOPIC_AWR {-2.};
constexpr int DEFAULT_NMU {33};
// Mgxs::get_xs enumerated types
// TODO: Convert to enum
constexpr int MG_GET_XS_TOTAL {0};
constexpr int MG_GET_XS_ABSORPTION {1};
constexpr int MG_GET_XS_INVERSE_VELOCITY {2};
constexpr int MG_GET_XS_DECAY_RATE {3};
constexpr int MG_GET_XS_SCATTER {4};
constexpr int MG_GET_XS_SCATTER_MULT {5};
constexpr int MG_GET_XS_SCATTER_FMU_MULT {6};
constexpr int MG_GET_XS_SCATTER_FMU {7};
constexpr int MG_GET_XS_FISSION {8};
constexpr int MG_GET_XS_KAPPA_FISSION {9};
constexpr int MG_GET_XS_PROMPT_NU_FISSION {10};
constexpr int MG_GET_XS_DELAYED_NU_FISSION {11};
constexpr int MG_GET_XS_NU_FISSION {12};
constexpr int MG_GET_XS_CHI_PROMPT {13};
constexpr int MG_GET_XS_CHI_DELAYED {14};
enum class MgxsType {
TOTAL,
ABSORPTION,
INVERSE_VELOCITY,
DECAY_RATE,
SCATTER,
SCATTER_MULT,
SCATTER_FMU_MULT,
SCATTER_FMU,
FISSION,
KAPPA_FISSION,
PROMPT_NU_FISSION,
DELAYED_NU_FISSION,
NU_FISSION,
CHI_PROMPT,
CHI_DELAYED
};
// ============================================================================
// TALLY-RELATED CONSTANTS
// Tally result entries
constexpr int RESULT_VALUE {0};
constexpr int RESULT_SUM {1};
constexpr int RESULT_SUM_SQ {2};
enum class TallyResult {
VALUE,
SUM,
SUM_SQ
};
// Tally type
// TODO: Convert to enum
constexpr int TALLY_VOLUME {1};
constexpr int TALLY_MESH_SURFACE {2};
constexpr int TALLY_SURFACE {3};
enum class TallyType {
VOLUME,
MESH_SURFACE,
SURFACE
};
// Tally estimator types
// TODO: Convert to enum
constexpr int ESTIMATOR_ANALOG {1};
constexpr int ESTIMATOR_TRACKLENGTH {2};
constexpr int ESTIMATOR_COLLISION {3};
enum class TallyEstimator {
ANALOG,
TRACKLENGTH,
COLLISION
};
// Event types for tallies
// TODO: Convert to enum
constexpr int EVENT_SURFACE {-2};
constexpr int EVENT_LATTICE {-1};
constexpr int EVENT_KILL {0};
constexpr int EVENT_SCATTER {1};
constexpr int EVENT_ABSORB {2};
enum class TallyEvent {
SURFACE,
LATTICE,
KILL,
SCATTER,
ABSORB
};
// Tally score type -- if you change these, make sure you also update the
// _SCORES dictionary in openmc/capi/tally.py
// TODO: Convert to enum
constexpr int SCORE_FLUX {-1}; // flux
constexpr int SCORE_TOTAL {-2}; // total reaction rate
constexpr int SCORE_SCATTER {-3}; // scattering rate
constexpr int SCORE_NU_SCATTER {-4}; // scattering production rate
constexpr int SCORE_ABSORPTION {-5}; // absorption rate
constexpr int SCORE_FISSION {-6}; // fission rate
constexpr int SCORE_NU_FISSION {-7}; // neutron production rate
constexpr int SCORE_KAPPA_FISSION {-8}; // fission energy production rate
constexpr int SCORE_CURRENT {-9}; // current
constexpr int SCORE_EVENTS {-10}; // number of events
constexpr int SCORE_DELAYED_NU_FISSION {-11}; // delayed neutron production rate
constexpr int SCORE_PROMPT_NU_FISSION {-12}; // prompt neutron production rate
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
// Tally map bin finding
constexpr int NO_BIN_FOUND {-1};
// Tally filter and map types
// TODO: Refactor to remove or convert to enum
constexpr int FILTER_UNIVERSE {1};
constexpr int FILTER_MATERIAL {2};
constexpr int FILTER_CELL {3};
// Mesh types
constexpr int MESH_REGULAR {1};
// Tally surface current directions
constexpr int OUT_LEFT {1}; // x min
constexpr int IN_LEFT {2}; // x min
constexpr int OUT_RIGHT {3}; // x max
constexpr int IN_RIGHT {4}; // x max
constexpr int OUT_BACK {5}; // y min
constexpr int IN_BACK {6}; // y min
constexpr int OUT_FRONT {7}; // y max
constexpr int IN_FRONT {8}; // y max
constexpr int OUT_BOTTOM {9}; // z min
constexpr int IN_BOTTOM {10}; // z min
constexpr int OUT_TOP {11}; // z max
constexpr int IN_TOP {12}; // z max
//
// These are kept as a normal enum and made negative, since variables which
// store one of these enum values usually also may be responsible for storing
// MT numbers from the long enum above.
enum TallyScore {
SCORE_FLUX = -1, // flux
SCORE_TOTAL = -2, // total reaction rate
SCORE_SCATTER = -3, // scattering rate
SCORE_NU_SCATTER = -4, // scattering production rate
SCORE_ABSORPTION = -5, // absorption rate
SCORE_FISSION = -6, // fission rate
SCORE_NU_FISSION = -7, // neutron production rate
SCORE_KAPPA_FISSION = -8, // fission energy production rate
SCORE_CURRENT = -9, // current
SCORE_EVENTS = -10, // number of events
SCORE_DELAYED_NU_FISSION = -11, // delayed neutron production rate
SCORE_PROMPT_NU_FISSION = -12, // prompt neutron production rate
SCORE_INVERSE_VELOCITY = -13, // flux-weighted inverse velocity
SCORE_FISS_Q_PROMPT = -14, // prompt fission Q-value
SCORE_FISS_Q_RECOV = -15, // recoverable fission Q-value
SCORE_DECAY_RATE = -16 // delayed neutron precursor decay rate
};
// Global tally parameters
constexpr int N_GLOBAL_TALLIES {4};
constexpr int K_COLLISION {0};
constexpr int K_ABSORPTION {1};
constexpr int K_TRACKLENGTH {2};
constexpr int LEAKAGE {3};
enum class GlobalTally {
K_COLLISION,
K_ABSORPTION,
K_TRACKLENGTH,
LEAKAGE
};
// Miscellaneous
constexpr int C_NONE {-1};
@ -413,12 +374,14 @@ enum class Interpolation {
histogram = 1, lin_lin = 2, lin_log = 3, log_lin = 4, log_log = 5
};
// Run modes
constexpr int RUN_MODE_FIXEDSOURCE {1};
constexpr int RUN_MODE_EIGENVALUE {2};
constexpr int RUN_MODE_PLOTTING {3};
constexpr int RUN_MODE_PARTICLE {4};
constexpr int RUN_MODE_VOLUME {5};
enum class RunMode {
UNSET, // default value, OpenMC throws error if left to this
FIXED_SOURCE,
EIGENVALUE,
PLOTTING,
PARTICLE,
VOLUME
};
// ============================================================================
// CMFD CONSTANTS

View file

@ -14,14 +14,6 @@ extern "C" const bool dagmc_enabled;
namespace openmc {
namespace simulation {
extern moab::DagMC::RayHistory history; //!< facet history for DagMC particles
extern Direction last_dir; //!< last direction passed to DagMC's ray_fire
#pragma omp threadprivate(history, last_dir)
}
namespace model {
extern moab::DagMC* DAG;
}

View file

@ -21,7 +21,7 @@ namespace openmc {
class Distribution {
public:
virtual ~Distribution() = default;
virtual double sample() const = 0;
virtual double sample(uint64_t* seed) const = 0;
};
//==============================================================================
@ -34,8 +34,9 @@ public:
Discrete(const double* x, const double* p, int n);
//! Sample a value from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled value
double sample() const;
double sample(uint64_t* seed) const;
// Properties
const std::vector<double>& x() const { return x_; }
@ -58,8 +59,9 @@ public:
Uniform(double a, double b) : a_{a}, b_{b} {};
//! Sample a value from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled value
double sample() const;
double sample(uint64_t* seed) const;
private:
double a_; //!< Lower bound of distribution
double b_; //!< Upper bound of distribution
@ -75,8 +77,9 @@ public:
Maxwell(double theta) : theta_{theta} { };
//! Sample a value from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled value
double sample() const;
double sample(uint64_t* seed) const;
private:
double theta_; //!< Factor in exponential [eV]
};
@ -91,8 +94,9 @@ public:
Watt(double a, double b) : a_{a}, b_{b} { };
//! Sample a value from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled value
double sample() const;
double sample(uint64_t* seed) const;
private:
double a_; //!< Factor in exponential [eV]
double b_; //!< Factor in square root [1/eV]
@ -108,8 +112,9 @@ public:
Normal(double mean_value, double std_dev) : mean_value_{mean_value}, std_dev_{std_dev} { };
//! Sample a value from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled value
double sample() const;
double sample(uint64_t* seed) const;
private:
double mean_value_; //!< middle of distribution [eV]
double std_dev_; //!< standard deviation [eV]
@ -126,8 +131,9 @@ public:
Muir(double e0, double m_rat, double kt) : e0_{e0}, m_rat_{m_rat}, kt_{kt} { };
//! Sample a value from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled value
double sample() const;
double sample(uint64_t* seed) const;
private:
// example DT fusion m_rat = 5 (D = 2 + T = 3)
// ion temp = 20000 eV
@ -148,8 +154,9 @@ public:
const double* c=nullptr);
//! Sample a value from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled value
double sample() const;
double sample(uint64_t* seed) const;
// x property
std::vector<double>& x() { return x_; }
@ -178,8 +185,9 @@ public:
Equiprobable(const double* x, int n) : x_{x, x+n} { };
//! Sample a value from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled value
double sample() const;
double sample(uint64_t* seed) const;
private:
std::vector<double> x_; //! Possible outcomes
};

View file

@ -23,8 +23,9 @@ public:
//! Sample an angle given an incident particle energy
//! \param[in] E Particle energy in [eV]
//! \param[inout] seed pseudorandom number seed pointer
//! \return Cosine of the angle in the range [-1,1]
double sample(double E) const;
double sample(double E, uint64_t* seed) const;
//! Determine whether angle distribution is empty
//! \return Whether distribution is empty

View file

@ -22,7 +22,7 @@ namespace openmc {
class EnergyDistribution {
public:
virtual double sample(double E) const = 0;
virtual double sample(double E, uint64_t* seed) const = 0;
virtual ~EnergyDistribution() = default;
};
@ -36,8 +36,9 @@ public:
//! Sample energy distribution
//! \param[in] E Incident particle energy in [eV]
//! \param[inout] seed Pseudorandom number seed pointer
//! \return Sampled energy in [eV]
double sample(double E) const;
double sample(double E, uint64_t* seed) const;
private:
int primary_flag_; //!< Indicator of whether the photon is a primary or
//!< non-primary photon.
@ -55,8 +56,9 @@ public:
//! Sample energy distribution
//! \param[in] E Incident particle energy in [eV]
//! \param[inout] seed Pseudorandom number seed pointer
//! \return Sampled energy in [eV]
double sample(double E) const;
double sample(double E, uint64_t* seed) const;
private:
double threshold_; //!< Energy threshold in lab, (A + 1)/A * |Q|
double mass_ratio_; //!< (A/(A+1))^2
@ -74,8 +76,9 @@ public:
//! Sample energy distribution
//! \param[in] E Incident particle energy in [eV]
//! \param[inout] seed Pseudorandom number seed pointer
//! \return Sampled energy in [eV]
double sample(double E) const;
double sample(double E, uint64_t* seed) const;
private:
//! Outgoing energy for a single incoming energy
struct CTTable {
@ -103,8 +106,9 @@ public:
//! Sample energy distribution
//! \param[in] E Incident particle energy in [eV]
//! \param[inout] seed Pseudorandom number seed pointer
//! \return Sampled energy in [eV]
double sample(double E) const;
double sample(double E, uint64_t* seed) const;
private:
Tabulated1D theta_; //!< Incoming energy dependent parameter
double u_; //!< Restriction energy
@ -121,8 +125,9 @@ public:
//! Sample energy distribution
//! \param[in] E Incident particle energy in [eV]
//! \param[inout] seed Pseudorandom number seed pointer
//! \return Sampled energy in [eV]
double sample(double E) const;
double sample(double E, uint64_t* seed) const;
private:
Tabulated1D theta_; //!< Incoming energy dependent parameter
double u_; //!< Restriction energy
@ -139,8 +144,9 @@ public:
//! Sample energy distribution
//! \param[in] E Incident particle energy in [eV]
//! \param[inout] seed Pseudorandom number seed pointer
//! \return Sampled energy in [eV]
double sample(double E) const;
double sample(double E, uint64_t* seed) const;
private:
Tabulated1D a_; //!< Energy-dependent 'a' parameter
Tabulated1D b_; //!< Energy-dependent 'b' parameter

View file

@ -23,8 +23,9 @@ public:
virtual ~UnitSphereDistribution() = default;
//! Sample a direction from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Direction sampled
virtual Direction sample() const = 0;
virtual Direction sample(uint64_t* seed) const = 0;
Direction u_ref_ {0.0, 0.0, 1.0}; //!< reference direction
};
@ -39,8 +40,9 @@ public:
explicit PolarAzimuthal(pugi::xml_node node);
//! Sample a direction from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Direction sampled
Direction sample() const;
Direction sample(uint64_t* seed) const;
private:
UPtrDist mu_; //!< Distribution of polar angle
UPtrDist phi_; //!< Distribution of azimuthal angle
@ -55,8 +57,9 @@ public:
Isotropic() { };
//! Sample a direction from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled direction
Direction sample() const;
Direction sample(uint64_t* seed) const;
};
//==============================================================================
@ -69,8 +72,9 @@ public:
explicit Monodirectional(pugi::xml_node node) : UnitSphereDistribution{node} { };
//! Sample a direction from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled direction
Direction sample() const;
Direction sample(uint64_t* seed) const;
};
using UPtrAngle = std::unique_ptr<UnitSphereDistribution>;

View file

@ -17,7 +17,7 @@ public:
virtual ~SpatialDistribution() = default;
//! Sample a position from the distribution
virtual Position sample() const = 0;
virtual Position sample(uint64_t* seed) const = 0;
};
//==============================================================================
@ -29,14 +29,54 @@ public:
explicit CartesianIndependent(pugi::xml_node node);
//! Sample a position from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled position
Position sample() const;
Position sample(uint64_t* seed) const;
private:
UPtrDist x_; //!< Distribution of x coordinates
UPtrDist y_; //!< Distribution of y coordinates
UPtrDist z_; //!< Distribution of z coordinates
};
//==============================================================================
//! Distribution of points specified by cylindrical coordinates r,phi,z
//==============================================================================
class CylindricalIndependent : public SpatialDistribution {
public:
explicit CylindricalIndependent(pugi::xml_node node);
//! Sample a position from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled position
Position sample(uint64_t* seed) const;
private:
UPtrDist r_; //!< Distribution of r coordinates
UPtrDist phi_; //!< Distribution of phi coordinates
UPtrDist z_; //!< Distribution of z coordinates
Position origin_; //!< Cartesian coordinates of the cylinder center
};
//==============================================================================
//! Distribution of points specified by spherical coordinates r,theta,phi
//==============================================================================
class SphericalIndependent : public SpatialDistribution {
public:
explicit SphericalIndependent(pugi::xml_node node);
//! Sample a position from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled position
Position sample(uint64_t* seed) const;
private:
UPtrDist r_; //!< Distribution of r coordinates
UPtrDist theta_; //!< Distribution of theta coordinates
UPtrDist phi_; //!< Distribution of phi coordinates
Position origin_; //!< Cartesian coordinates of the sphere center
};
//==============================================================================
//! Uniform distribution of points over a box
//==============================================================================
@ -46,8 +86,9 @@ public:
explicit SpatialBox(pugi::xml_node node, bool fission=false);
//! Sample a position from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled position
Position sample() const;
Position sample(uint64_t* seed) const;
// Properties
bool only_fissionable() const { return only_fissionable_; }
@ -68,8 +109,9 @@ public:
explicit SpatialPoint(pugi::xml_node node);
//! Sample a position from the distribution
//! \param seed Pseudorandom number seed pointer
//! \return Sampled position
Position sample() const;
Position sample(uint64_t* seed) const;
private:
Position r_; //!< Single position at which sites are generated
};

View file

@ -42,14 +42,6 @@ void calculate_generation_keff();
//! generations. It also broadcasts the value from the master process.
void calculate_average_keff();
#ifdef _OPENMP
//! Join threadprivate fission banks into a single fission bank
//!
//! Note that this operation is necessarily sequential to preserve the order of
//! the bank when using varying numbers of threads.
void join_bank_from_threads();
#endif
//! Calculates a minimum variance estimate of k-effective
//!
//! The minimum variance estimate is based on a linear combination of the

115
include/openmc/event.h Normal file
View file

@ -0,0 +1,115 @@
#ifndef OPENMC_EVENT_H
#define OPENMC_EVENT_H
//! \file event.h
//! \brief Event-based data structures and methods
#include "openmc/particle.h"
#include "openmc/shared_array.h"
namespace openmc {
//==============================================================================
// Structs
//==============================================================================
// In the event-based model, instead of moving or sorting the particles
// themselves based on which event they need, a queue is used to store the
// index (and other useful info) for each event type.
// The EventQueueItem struct holds the relevant information about a particle needed
// for sorting the queue. For very high particle counts, a sorted queue has the
// potential to result in greatly improved cache efficiency. However, sorting
// will introduce some overhead due to the sorting process itself, and may not
// result in any benefits if not enough particles are present for them to achieve
// consistent locality improvements.
struct EventQueueItem{
int64_t idx; //!< particle index in event-based particle buffer
Particle::Type type; //!< particle type
int64_t material; //!< material that particle is in
double E; //!< particle energy
// Constructors
EventQueueItem() = default;
EventQueueItem(const Particle& p, int64_t buffer_idx) :
idx(buffer_idx), type(p.type_), material(p.material_), E(p.E_) {}
// Compare by particle type, then by material type (4.5% fuel/7.0% fuel/cladding/etc),
// then by energy.
// TODO: Currently in OpenMC, the material ID corresponds not only to a general
// type, but also specific isotopic densities. Ideally we would
// like to be able to just sort by general material type, regardless of densities.
// A more general material type ID may be added in the future, in which case we
// can update the material field of this struct to contain the more general id.
bool operator<(const EventQueueItem& rhs) const
{
return std::tie(type, material, E) < std::tie(rhs.type, rhs.material, rhs.E);
}
};
//==============================================================================
// Global variable declarations
//==============================================================================
namespace simulation {
// Event queues. These use the special SharedArray type, rather than a normal
// vector, as they will be shared between threads and may be appended to at the
// same time. To facilitate this, the SharedArray thread_safe_append() method
// is provided which controls the append operations using atomics.
extern SharedArray<EventQueueItem> calculate_fuel_xs_queue;
extern SharedArray<EventQueueItem> calculate_nonfuel_xs_queue;
extern SharedArray<EventQueueItem> advance_particle_queue;
extern SharedArray<EventQueueItem> surface_crossing_queue;
extern SharedArray<EventQueueItem> collision_queue;
// Particle buffer
extern std::vector<Particle> particles;
} // namespace simulation
//==============================================================================
// Functions
//==============================================================================
//! Allocate space for the event queues and particle buffer
//
//! \param n_particles The number of particles in the particle buffer
void init_event_queues(int64_t n_particles);
//! Free the event queues and particle buffer
void free_event_queues(void);
//! Enqueue a particle based on if it is in fuel or a non-fuel material
//
//! \param buffer_idx The particle's actual index in the particle buffer
void dispatch_xs_event(int64_t buffer_idx);
//! Execute the initialization event for all particles
//
//! \param n_particles The number of particles in the particle buffer
//! \param source_offset The offset index in the source bank to use
void process_init_events(int64_t n_particles, int64_t source_offset);
//! Execute the calculate XS event for all particles in this event's buffer
//
//! \param queue A reference to the desired XS lookup queue
void process_calculate_xs_events(SharedArray<EventQueueItem>& queue);
//! Execute the advance particle event for all particles in this event's buffer
void process_advance_particle_events();
//! Execute the surface crossing event for all particles in this event's buffer
void process_surface_crossing_events();
//! Execute the collision event for all particles in this event's buffer
void process_collision_events();
//! Execute the death event for all particles
//
//! \param n_particles The number of particles in the particle buffer
void process_death_events(int64_t n_particles);
} // namespace openmc
#endif // OPENMC_EVENT_H

View file

@ -24,17 +24,6 @@ extern std::vector<int64_t> overlap_check_count;
} // namespace model
//==============================================================================
// Information about nearest boundary crossing
//==============================================================================
struct BoundaryInfo {
double distance {INFINITY}; //!< distance to nearest boundary
int surface_index {0}; //!< if boundary is surface, index in surfaces vector
int coord_level; //!< coordinate level after crossing boundary
std::array<int, 3> lattice_translation {}; //!< which way lattice indices will change
};
//==============================================================================
//! Check two distances by coincidence tolerance
//==============================================================================

View file

@ -7,9 +7,15 @@
#include <cstdint>
#include <string>
#include <vector>
#include <unordered_map>
namespace openmc {
namespace model {
extern std::unordered_map<int32_t, std::unordered_map<int32_t, int32_t>> universe_cell_counts;
extern std::unordered_map<int32_t, int32_t> universe_level_counts;
} // namespace model
void read_geometry_xml();
//==============================================================================

View file

@ -345,7 +345,7 @@ read_dataset(hid_t obj_id, const char* name, Position& r, bool indep=false)
}
template <typename T, std::size_t N>
void read_dataset_as_shape(hid_t obj_id, const char* name,
inline void read_dataset_as_shape(hid_t obj_id, const char* name,
xt::xtensor<T, N>& arr, bool indep=false)
{
hid_t dset = open_dataset(obj_id, name);
@ -367,7 +367,7 @@ void read_dataset_as_shape(hid_t obj_id, const char* name,
template <typename T, std::size_t N>
void read_nd_vector(hid_t obj_id, const char* name, xt::xtensor<T, N>& result,
inline void read_nd_vector(hid_t obj_id, const char* name, xt::xtensor<T, N>& result,
bool must_have=false)
{
if (object_exists(obj_id, name)) {

View file

@ -11,6 +11,7 @@
#include "pugixml.hpp"
#include "xtensor/xtensor.hpp"
#include "openmc/constants.h"
#include "openmc/bremsstrahlung.h"
#include "openmc/particle.h"
@ -24,8 +25,8 @@ class Material;
namespace model {
extern std::vector<std::unique_ptr<Material>> materials;
extern std::unordered_map<int32_t, int32_t> material_map;
extern std::vector<std::unique_ptr<Material>> materials;
} // namespace model
@ -132,7 +133,7 @@ public:
//----------------------------------------------------------------------------
// Data
int32_t id_; //!< Unique ID
int32_t id_ {C_NONE}; //!< 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

@ -129,11 +129,14 @@ extern "C" void calc_zn_rad(int n, double rho, double zn_rad[]);
//! \param mu The cosine of angle in lab or CM
//! \param phi The azimuthal angle; will randomly chosen angle if a nullptr
//! is passed
//! \param seed A pointer to the pseudorandom seed
//==============================================================================
extern "C" void rotate_angle_c(double uvw[3], double mu, const double* phi);
extern "C" void rotate_angle_c(double uvw[3], double mu, const double* phi,
uint64_t* seed);
Direction rotate_angle(Direction u, double mu, const double* phi);
Direction rotate_angle(Direction u, double mu, const double* phi,
uint64_t* seed);
//==============================================================================
//! Samples an energy from the Maxwell fission distribution based on a direct
@ -144,10 +147,11 @@ Direction rotate_angle(Direction u, double mu, const double* phi);
//! rule C64 in the Monte Carlo Sampler LA-9721-MS.
//!
//! \param T The tabulated function of the incoming energy
//! \param seed A pointer to the pseudorandom seed
//! \return The sampled outgoing energy
//==============================================================================
extern "C" double maxwell_spectrum(double T);
extern "C" double maxwell_spectrum(double T, uint64_t* seed);
//==============================================================================
//! Samples an energy from a Watt energy-dependent fission distribution.
@ -159,10 +163,11 @@ extern "C" double maxwell_spectrum(double T);
//!
//! \param a Watt parameter a
//! \param b Watt parameter b
//! \param seed A pointer to the pseudorandom seed
//! \return The sampled outgoing energy
//==============================================================================
extern "C" double watt_spectrum(double a, double b);
extern "C" double watt_spectrum(double a, double b, uint64_t* seed);
//==============================================================================
//! Samples an energy from the Gaussian energy-dependent fission distribution.
@ -175,10 +180,11 @@ extern "C" double watt_spectrum(double a, double b);
//!
//! @param mean mean of the Gaussian distribution
//! @param std_dev standard deviation of the Gaussian distribution
//! @param seed A pointer to the pseudorandom seed
//! @result The sampled outgoing energy
//==============================================================================
extern "C" double normal_variate(double mean, double std_dev);
extern "C" double normal_variate(double mean, double std_dev, uint64_t* seed);
//==============================================================================
//! Samples an energy from the Muir (Gaussian) energy-dependent distribution.
@ -190,10 +196,12 @@ extern "C" double normal_variate(double mean, double std_dev);
//! @param e0 peak neutron energy [eV]
//! @param m_rat ratio of the fusion reactants to AMU
//! @param kt the ion temperature of the reactants [eV]
//! @param seed A pointer to the pseudorandom seed
//! @result The sampled outgoing energy
//==============================================================================
extern "C" double muir_spectrum(double e0, double m_rat, double kt);
extern "C" double muir_spectrum(double e0, double m_rat, double kt,
uint64_t* seed);
//==============================================================================
//! Doppler broadens the windowed multipole curvefit.

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
@ -160,7 +161,7 @@ public:
//! \param[in] bank Array of bank sites
//! \param[out] Whether any bank sites are outside the mesh
//! \return Array indicating number of sites in each mesh/energy bin
xt::xtensor<double, 1> count_sites(const std::vector<Particle::Bank>& bank,
xt::xtensor<double, 1> count_sites(const Particle::Bank* bank, int64_t length,
bool* outside) const;
// Data members

View file

@ -11,6 +11,7 @@
#include "openmc/constants.h"
#include "openmc/hdf5_interface.h"
#include "openmc/particle.h"
#include "openmc/xsdata.h"
@ -38,7 +39,7 @@ class Mgxs {
private:
xt::xtensor<double, 1> kTs; // temperature in eV (k * T)
int scatter_format; // flag for if this is legendre, histogram, or tabular
AngleDistributionType scatter_format; // flag for if this is legendre, histogram, or tabular
int num_delayed_groups; // number of delayed neutron groups
int num_groups; // number of energy groups
std::vector<XsData> xs; // Cross section data
@ -63,7 +64,7 @@ class Mgxs {
//! @param in_azimuthal Azimuthal angle grid.
void
init(const std::string& in_name, double in_awr, const std::vector<double>& in_kTs,
bool in_fissionable, int in_scatter_format, bool in_is_isotropic,
bool in_fissionable, AngleDistributionType in_scatter_format, bool in_is_isotropic,
const std::vector<double>& in_polar, const std::vector<double>& in_azimuthal);
//! \brief Initializes the Mgxs object metadata from the HDF5 file
@ -110,7 +111,10 @@ class Mgxs {
//!
//! @param xs_id HDF5 group id for the cross section data.
//! @param temperature Temperatures to read.
Mgxs(hid_t xs_id, const std::vector<double>& temperature);
//! @param num_group number of energy groups
//! @param num_delay number of delayed groups
Mgxs(hid_t xs_id, const std::vector<double>& temperature,
int num_group, int num_delay);
//! \brief Constructor that initializes and populates all data to build a
//! macroscopic cross section from microscopic cross section.
@ -119,8 +123,11 @@ class Mgxs {
//! @param mat_kTs temperatures (in units of eV) that data is needed.
//! @param micros Microscopic objects to combine.
//! @param atom_densities Atom densities of those microscopic quantities.
//! @param num_group number of energy groups
//! @param num_delay number of delayed groups
Mgxs(const std::string& in_name, const std::vector<double>& mat_kTs,
const std::vector<Mgxs*>& micros, const std::vector<double>& atom_densities);
const std::vector<Mgxs*>& micros, const std::vector<double>& atom_densities,
int num_group, int num_delay);
//! \brief Provides a cross section value given certain parameters
//!
@ -134,16 +141,22 @@ class Mgxs {
//! @param dg delayed group index; use nullptr if irrelevant.
//! @return Requested cross section value.
double
get_xs(int xstype, int gin, const int* gout, const double* mu,
get_xs(MgxsType xstype, int gin, const int* gout, const double* mu,
const int* dg);
inline double
get_xs(MgxsType xstype, int gin)
{return get_xs(xstype, gin, nullptr, nullptr, nullptr);}
//! \brief Samples the fission neutron energy and if prompt or delayed.
//!
//! @param gin Incoming energy group.
//! @param dg Sampled delayed group index.
//! @param gout Sampled outgoing energy group.
//! @param seed Pseudorandom seed pointer
void
sample_fission_energy(int gin, int& dg, int& gout);
sample_fission_energy(int gin, int& dg, int& gout, uint64_t* seed);
//! \brief Samples the outgoing energy and angle from a scatter event.
//!
@ -151,20 +164,15 @@ class Mgxs {
//! @param gout Sampled outgoing energy group.
//! @param mu Sampled cosine of the change-in-angle.
//! @param wgt Weight of the particle to be adjusted.
//! @param seed Pseudorandom seed pointer.
void
sample_scatter(int gin, int& gout, double& mu, double& wgt);
sample_scatter(int gin, int& gout, double& mu, double& wgt, uint64_t* seed);
//! \brief Calculates cross section quantities needed for tracking.
//!
//! @param gin Incoming energy group.
//! @param sqrtkT Temperature of the material.
//! @param u Incoming particle direction.
//! @param total_xs Resultant total cross section.
//! @param abs_xs Resultant absorption cross section.
//! @param nu_fiss_xs Resultant nu-fission cross section.
//! @param p The particle whose attributes set which MGXS to get.
void
calculate_xs(int gin, double sqrtkT, Direction u,
double& total_xs, double& abs_xs, double& nu_fiss_xs);
calculate_xs(Particle& p);
//! \brief Sets the temperature index in cache given a temperature
//!

View file

@ -12,70 +12,71 @@
namespace openmc {
//==============================================================================
// Global variables
// Global MGXS data container structure
//==============================================================================
class MgxsInterface {
public:
MgxsInterface() = default;
// Construct from path to cross sections file, as well as a list
// of XS to read and the corresponding temperatures for each XS
MgxsInterface(const std::string& path_cross_sections,
const std::vector<std::string> xs_to_read,
const std::vector<std::vector<double>> xs_temps);
// Does things to construct after the nuclides and temperatures to
// read have been specified.
void init();
// Set which nuclides and temperatures are to be read
void set_nuclides_and_temperatures(std::vector<std::string> xs_to_read,
std::vector<std::vector<double>> xs_temps);
// Add an Mgxs object to be managed
void add_mgxs(hid_t file_id, const std::string& name,
const std::vector<double>& temperature);
// Reads just the header of the cross sections file, to find
// min & max energies as well as the available XS
void read_header(const std::string& path_cross_sections);
// Calculate microscopic cross sections from nuclide macro XS
void create_macro_xs();
// Get the kT values which are used in the OpenMC model
std::vector<std::vector<double>> get_mat_kTs();
int num_energy_groups_;
int num_delayed_groups_;
std::vector<std::string> xs_names_; // available names in HDF5 file
std::vector<std::string> xs_to_read_; // XS which appear in materials
std::vector<std::vector<double>> xs_temps_to_read_; // temperatures used
std::string cross_sections_path_; // path to MGXS h5 file
std::vector<Mgxs> nuclides_;
std::vector<Mgxs> macro_xs_;
std::vector<double> energy_bins_;
std::vector<double> energy_bin_avg_;
std::vector<double> rev_energy_bins_;
std::vector<std::vector<double>> nuc_temps_; // all available temperatures
};
namespace data {
extern MgxsInterface mg;
}
extern std::vector<Mgxs> nuclides_MG;
extern std::vector<Mgxs> macro_xs;
extern int num_energy_groups;
extern int num_delayed_groups;
extern std::vector<double> energy_bins;
extern std::vector<double> energy_bin_avg;
extern std::vector<double> rev_energy_bins;
// Puts available XS in MGXS file to globals so that when
// materials are read, the MGXS specified in a material can
// be ensured to be present in the available data.
void put_mgxs_header_data_to_globals();
} // namespace data
// Set which nuclides and temperatures are to be read on
// mg through global data
void set_mg_interface_nuclides_and_temps();
//==============================================================================
// Mgxs data loading interface methods
//==============================================================================
void read_mgxs();
void
add_mgxs(hid_t file_id, const std::string& name,
const std::vector<double>& temperature);
void create_macro_xs();
std::vector<std::vector<double>> get_mat_kTs();
void read_mg_cross_sections_header();
//==============================================================================
// Mgxs tracking/transport/tallying interface methods
//==============================================================================
extern "C" void
calculate_xs_c(int i_mat, int gin, double sqrtkT, Direction u,
double& total_xs, double& abs_xs, double& nu_fiss_xs);
double
get_nuclide_xs(int index, int xstype, int gin, const int* gout,
const double* mu, const int* dg);
inline double
get_nuclide_xs(int index, int xstype, int gin)
{return get_nuclide_xs(index, xstype, gin, nullptr, nullptr, nullptr);}
double
get_macro_xs(int index, int xstype, int gin, const int* gout,
const double* mu, const int* dg);
inline double
get_macro_xs(int index, int xstype, int gin)
{return get_macro_xs(index, xstype, gin, nullptr, nullptr, nullptr);}
//==============================================================================
// General Mgxs methods
//==============================================================================
extern "C" void
get_name_c(int index, int name_len, char* name);
extern "C" double
get_awr_c(int index);
// After macro XS have been read, materials can be marked as fissionable
void mark_fissionable_mgxs_materials();
} // namespace openmc
#endif // OPENMC_MGXS_INTERFACE_H

View file

@ -97,7 +97,7 @@ public:
std::vector<int> index_inelastic_scatter_;
private:
void create_derived();
void create_derived(const Function1D* prompt_photons, const Function1D* delayed_photons);
static int XS_TOTAL;
static int XS_ABSORPTION;

View file

@ -13,6 +13,13 @@
#include "openmc/constants.h"
#include "openmc/position.h"
#include "openmc/random_lcg.h"
#include "openmc/tallies/filter_match.h"
#ifdef DAGMC
#include "DagMC.hpp"
#endif
namespace openmc {
@ -130,6 +137,17 @@ struct MacroXS {
double pair_production; //!< macroscopic pair production xs
};
//==============================================================================
// Information about nearest boundary crossing
//==============================================================================
struct BoundaryInfo {
double distance {INFINITY}; //!< distance to nearest boundary
int surface_index {0}; //!< if boundary is surface, index in surfaces vector
int coord_level; //!< coordinate level after crossing boundary
std::array<int, 3> lattice_translation {}; //!< which way lattice indices will change
};
//============================================================================
//! State of a particle being transported through geometry
//============================================================================
@ -145,6 +163,12 @@ public:
};
//! Saved ("banked") state of a particle
//! NOTE: This structure's MPI type is built in initialize_mpi() of
//! initialize.cpp. Any changes made to the struct here must also be
//! made when building the Bank MPI type in initialize_mpi().
//! NOTE: This structure is also used on the python side, and is defined
//! in lib/core.py. Changes made to the type here must also be made to the
//! python defintion.
struct Bank {
Position r;
Direction u;
@ -152,6 +176,15 @@ public:
double wgt;
int delayed_group;
Type particle;
int64_t parent_id;
int64_t progeny_id;
};
//! Saved ("banked") state of a particle, for nu-fission tallying
struct NuBank {
double E; //!< particle energy
double wgt; //!< particle weight
int delayed_group; //!< particle delayed group
};
//==========================================================================
@ -198,8 +231,13 @@ public:
//! \param src Source site data
void from_source(const Bank* src);
//! Transport a particle from birth to death
void transport();
// Coarse-grained particle events
void event_calculate_xs();
void event_advance();
void event_cross_surface();
void event_collide();
void event_revive_from_secondary();
void event_death();
//! Cross a surface and handle boundary conditions
void cross_surface();
@ -217,6 +255,10 @@ public:
//! create a particle restart HDF5 file
void write_restart() const;
//! Gets the pointer to the particle's current PRN seed
uint64_t* current_seed() {return seeds_ + stream_;}
const uint64_t* current_seed() const {return seeds_ + stream_;}
//==========================================================================
// Data members
@ -258,7 +300,7 @@ public:
// What event took place
bool fission_ {false}; //!< did particle cause implicit fission
int event_; //!< scatter, absorption
TallyEvent event_; //!< scatter, absorption
int event_nuclide_; //!< index in nuclides array
int event_mt_; //!< reaction MT
int delayed_group_ {0}; //!< delayed group
@ -271,10 +313,13 @@ public:
//!< sites banked
// Indices for various arrays
int surface_ {0}; //!< index for surface particle is on
int surface_ {0}; //!< index for surface particle is on
int cell_born_ {-1}; //!< index for cell particle was born in
int material_ {-1}; //!< index for current material
int material_last_ {-1}; //!< index for last material
// Boundary information
BoundaryInfo boundary_;
// Temperature of current cell
double sqrtkT_ {-1.0}; //!< sqrt(k_Boltzmann * temperature) in eV
@ -285,6 +330,43 @@ public:
// Track output
bool write_track_ {false};
// Current PRNG state
uint64_t seeds_[N_STREAMS]; // current seeds
int stream_; // current RNG stream
// Secondary particle bank
std::vector<Particle::Bank> secondary_bank_;
int64_t current_work_; // current work index
std::vector<double> flux_derivs_; // for derivatives for this particle
std::vector<FilterMatch> filter_matches_; // tally filter matches
std::vector<std::vector<Position>> tracks_; // tracks for outputting to file
std::vector<NuBank> nu_bank_; // bank of most recently fissioned particles
// Global tally accumulators
double keff_tally_absorption_ {0.0};
double keff_tally_collision_ {0.0};
double keff_tally_tracklength_ {0.0};
double keff_tally_leakage_ {0.0};
bool trace_ {false}; //!< flag to show debug information
double collision_distance_; // distance to particle's next closest collision
int n_event_ {0}; // number of events executed in this particle's history
// DagMC state variables
#ifdef DAGMC
moab::DagMC::RayHistory history_;
Direction last_dir_;
#endif
int64_t n_progeny_ {0}; // Number of progeny produced by this particle
};
} // namespace openmc

View file

@ -45,12 +45,12 @@ public:
void calculate_xs(Particle& p) const;
void compton_scatter(double alpha, bool doppler, double* alpha_out,
double* mu, int* i_shell) const;
double* mu, int* i_shell, uint64_t* seed) const;
double rayleigh_scatter(double alpha) const;
double rayleigh_scatter(double alpha, uint64_t* seed) const;
void pair_production(double alpha, double* E_electron, double* E_positron,
double* mu_electron, double* mu_positron) const;
double* mu_electron, double* mu_positron, uint64_t* seed) const;
void atomic_relaxation(const ElectronSubshell& shell, Particle& p) const;
@ -96,14 +96,15 @@ public:
xt::xtensor<double, 2> dcs_;
private:
void compton_doppler(double alpha, double mu, double* E_out, int* i_shell) const;
void compton_doppler(double alpha, double mu, double* E_out, int* i_shell,
uint64_t* seed) const;
};
//==============================================================================
// Non-member functions
//==============================================================================
std::pair<double, double> klein_nishina(double alpha);
std::pair<double, double> klein_nishina(double alpha, uint64_t* seed);
void free_memory_photon();

View file

@ -27,15 +27,15 @@ void sample_neutron_reaction(Particle* p);
void sample_photon_reaction(Particle* p);
//! Terminates the particle and either deposits all energy locally
//! (electron_treatment = ELECTRON_LED) or creates secondary bremsstrahlung
//! (electron_treatment = ElectronTreatment::LED) or creates secondary bremsstrahlung
//! photons from electron deflections with charged particles (electron_treatment
//! = ELECTRON_TTB).
//! = ElectronTreatment::TTB).
void sample_electron_reaction(Particle* p);
//! Terminates the particle and either deposits all energy locally
//! (electron_treatment = ELECTRON_LED) or creates secondary bremsstrahlung
//! (electron_treatment = ElectronTreatment::LED) or creates secondary bremsstrahlung
//! photons from electron deflections with charged particles (electron_treatment
//! = ELECTRON_TTB). Two annihilation photons of energy MASS_ELECTRON_EV (0.511
//! = ElectronTreatment::TTB). Two annihilation photons of energy MASS_ELECTRON_EV (0.511
//! MeV) are created and travel in opposite directions.
void sample_positron_reaction(Particle* p);
@ -44,22 +44,21 @@ void sample_positron_reaction(Particle* p);
//!
//! \param[in] p Particle
//! \return Index in the data::nuclides vector
int sample_nuclide(const Particle* p);
int sample_nuclide(Particle* p);
//! Determine the average total, prompt, and delayed neutrons produced from
//! fission and creates appropriate bank sites.
void create_fission_sites(Particle* p, int i_nuclide, const Reaction* rx,
std::vector<Particle::Bank>& bank);
void create_fission_sites(Particle* p, int i_nuclide, const Reaction* rx);
int sample_element(Particle* p);
Reaction* sample_fission(int i_nuclide, const Particle* p);
Reaction* sample_fission(int i_nuclide, Particle* p);
void sample_photon_product(int i_nuclide, const Particle* p, int* i_rx, int* i_product);
void sample_photon_product(int i_nuclide, Particle* p, int* i_rx, int* i_product);
void absorption(Particle* p, int i_nuclide);
void scatter(Particle*, int i_nuclide);
void scatter(Particle* p, int i_nuclide);
//! Treats the elastic scattering of a neutron with a target.
void elastic_scatter(int i_nuclide, const Reaction& rx, double kT,
@ -72,15 +71,17 @@ void sab_scatter(int i_nuclide, int i_sab, Particle* p);
//! dependence of cross sections in treating resonance elastic scattering such
//! as the DBRC and a new, accelerated scheme are also implemented here.
Direction sample_target_velocity(const Nuclide* nuc, double E, Direction u,
Direction v_neut, double xs_eff, double kT);
Direction v_neut, double xs_eff, double kT, uint64_t* seed);
//! samples a target velocity based on the free gas scattering formulation, used
//! by most Monte Carlo codes, in which cross section is assumed to be constant
//! in energy. Excellent documentation for this method can be found in
//! FRA-TM-123.
Direction sample_cxs_target_velocity(double awr, double E, Direction u, double kT);
Direction sample_cxs_target_velocity(double awr, double E, Direction u, double kT,
uint64_t* seed);
void sample_fission_neutron(int i_nuclide, const Reaction* rx, double E_in, Particle::Bank* site);
void sample_fission_neutron(int i_nuclide, const Reaction* rx, double E_in,
Particle::Bank* site, uint64_t* seed);
//! handles all reactions with a single secondary neutron (other than fission),
//! i.e. level scattering, (n,np), (n,na), etc.

View file

@ -33,9 +33,8 @@ scatter(Particle* p);
//! \brief Determines the average total, prompt and delayed neutrons produced
//! from fission and creates the appropriate bank sites.
//! \param p Particle to operate on
//! \param bank The particle bank to populate
void
create_fission_sites(Particle* p, std::vector<Particle::Bank>& bank);
create_fission_sites(Particle* p);
//! \brief Handles an absorption event
//! \param p Particle to operate on

View file

@ -14,6 +14,7 @@
#include "openmc/geometry.h"
#include "openmc/particle.h"
#include "openmc/xml_interface.h"
#include "openmc/random_lcg.h"
namespace openmc {
@ -28,6 +29,9 @@ namespace model {
extern std::vector<Plot> plots; //!< Plot instance container
extern std::unordered_map<int, int> plot_map; //!< map of plot ids to index
extern uint64_t plotter_prn_seeds[N_STREAMS]; // Random number seeds used for plotter
extern int plotter_stream; // Stream index used by the plotter
} // namespace model
//===============================================================================

View file

@ -10,46 +10,66 @@ namespace openmc {
// Module constants.
//==============================================================================
extern "C" const int N_STREAMS;
extern "C" const int STREAM_TRACKING;
extern "C" const int STREAM_TALLIES;
extern "C" const int STREAM_SOURCE;
extern "C" const int STREAM_URR_PTABLE;
extern "C" const int STREAM_VOLUME;
extern "C" const int STREAM_PHOTON;
constexpr int64_t DEFAULT_SEED = 1;
constexpr int N_STREAMS {6};
constexpr int STREAM_TRACKING {0};
constexpr int STREAM_TALLIES {1};
constexpr int STREAM_SOURCE {2};
constexpr int STREAM_URR_PTABLE {3};
constexpr int STREAM_VOLUME {4};
constexpr int STREAM_PHOTON {5};
constexpr int64_t DEFAULT_SEED {1};
//==============================================================================
//! Generate a pseudo-random number using a linear congruential generator.
//! @param seed Pseudorandom number seed pointer
//! @return A random number between 0 and 1
//==============================================================================
extern "C" double prn();
double prn(uint64_t* seed);
//==============================================================================
//! Generate a random number which is 'n' times ahead from the current seed.
//!
//! The result of this function will be the same as the result from calling
//! `prn()` 'n' times.
//! `prn()` 'n' times, though without the side effect of altering the RNG
//! state.
//! @param n The number of RNG seeds to skip ahead by
//! @param seed Pseudorandom number seed
//! @return A random number between 0 and 1
//==============================================================================
extern "C" double future_prn(int64_t n);
double future_prn(int64_t n, uint64_t seed);
//==============================================================================
//! Set the RNG seed to a unique value based on the ID of the particle.
//! Set a RNG seed to a unique value based on a unique particle ID by striding
//! the seed.
//! @param id The particle ID
//! @param offset The offset from the master seed to be used (e.g., for creating
//! different streams)
//! @return The initialized seed value
//==============================================================================
uint64_t init_seed(int64_t id, int offset);
//==============================================================================
//! Set the RNG seeds to unique values based on the ID of the particle. This
//! function initializes the seeds for all RNG streams of the particle via
//! striding.
//! @param seeds Pseudorandom number seed array
//! @param id The particle ID
//==============================================================================
extern "C" void set_particle_seed(int64_t id);
void init_particle_seeds(int64_t id, uint64_t* seeds);
//==============================================================================
//! Advance the random number seed 'n' times from the current seed.
//! Advance the random number seed 'n' times from the current seed. This
//! differs from the future_prn() function in that this function does alter
//! the RNG state.
//! @param seed Pseudorandom number seed pointer
//! @param n The number of RNG seeds to skip ahead by
//==============================================================================
extern "C" void advance_prn_seed(int64_t n);
void advance_prn_seed(int64_t n, uint64_t* seed);
//==============================================================================
//! Advance a random number seed 'n' times.
@ -63,18 +83,6 @@ extern "C" void advance_prn_seed(int64_t n);
uint64_t future_seed(uint64_t n, uint64_t seed);
//==============================================================================
//! Switch the RNG to a different stream of random numbers.
//!
//! If random numbers are needed in routines not used directly for tracking
//! (e.g. physics), this allows the numbers to be generated without affecting
//! reproducibility of the physics.
//! @param n The RNG stream to switch to. Use the constants such as
//! `STREAM_TRACKING` and `STREAM_TALLIES` for this argument.
//==============================================================================
extern "C" void prn_set_stream(int n);
//==============================================================================
// API FUNCTIONS
//==============================================================================

View file

@ -42,7 +42,8 @@ public:
//! \param[in] E_in Incoming energy in [eV]
//! \param[out] E_out Outgoing energy in [eV]
//! \param[out] mu Outgoing cosine with respect to current direction
void sample(double E_in, double& E_out, double& mu) const;
//! \param[inout] seed Pseudorandom seed pointer
void sample(double E_in, double& E_out, double& mu, uint64_t* seed) const;
Particle::Type particle_; //!< Particle type
EmissionMode emission_mode_; //!< Emission mode

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