Merge pull request #2 from cn-skywalker/virtual_lattice_0.15.2

Virtual lattice 0.15.2
This commit is contained in:
Jingang Liang 2025-10-27 14:34:37 +08:00 committed by GitHub
commit be04e2804f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
1341 changed files with 141746 additions and 79654 deletions

View file

@ -84,6 +84,7 @@ PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
QualifierAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true

3
.git_archival.txt Normal file
View file

@ -0,0 +1,3 @@
commit: $Format:%H$
commit-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$

1
.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
.git_archival.txt export-subst

29
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View file

@ -0,0 +1,29 @@
---
name: Bug report
about: Report a bug that is preventing proper operation
title: ''
labels: Bugs
assignees: ''
---
<!--
If you are a user of OpenMC and are running into trouble with the code or are
seeking general user support, we highly recommend posting on the OpenMC
discourse forum first. GitHub issues should be used specifically for bug reports
and feature requests.
https://openmc.discourse.group/
-->
## Bug Description
<!--A clear and concise description of the problem (Note: A missing feature is not a bug).-->
## Steps to Reproduce
<!--Steps to reproduce the behavior (input file, or modifications to an existing input file, etc.)-->
## Environment
<!--Operating system, OpenMC version, how OpenMC was installed, nuclear data being used, etc.-->

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Troubleshooting and User Support
url: https://openmc.discourse.group/
about: For user support and troubleshooting, please use our Discourse forum

10
.github/ISSUE_TEMPLATE/documentation.md vendored Normal file
View file

@ -0,0 +1,10 @@
---
name: Documentation improvement
about: Found something incomplete or incorrect in our documentation?
title: ''
labels: Documentation
assignees: ''
---
<!--Describe the issue with the documentation and include a URL to the corresponding page-->

View file

@ -0,0 +1,19 @@
---
name: Feature or enhancement request
about: Suggest a new feature or enhancement to existing capabilities
title: ''
labels: ''
assignees: ''
---
## Description
<!--What is the feature or enhancement?-->
## Alternatives
<!--If alternative solutions have been considered, describe them here and the reasoning for the chosen solution --->
## Compatibility
<!--Will the enhancement change existing APIs or add something new?-->

24
.github/pull_request_template.md vendored Normal file
View file

@ -0,0 +1,24 @@
<!--
If you are a first-time contributor to OpenMC, please have a look at our
contributing guidelines:
https://github.com/openmc-dev/openmc/blob/develop/CONTRIBUTING.md
-->
# Description
Please include a summary of the change and which issue is fixed if applicable. Please also include relevant motivation and context.
Fixes # (issue)
# Checklist
- [ ] I have performed a self-review of my own code
- [ ] I have run [clang-format](https://docs.openmc.org/en/latest/devguide/styleguide.html#automatic-formatting) (version 15) on any C++ source files (if applicable)
- [ ] I have followed the [style guidelines](https://docs.openmc.org/en/latest/devguide/styleguide.html#python) for Python source files (if applicable)
- [ ] I have made corresponding changes to the documentation (if applicable)
- [ ] I have added tests that prove my fix is effective or that my feature works (if applicable)
<!--
While tests will automatically be checked by CI, it is good practice to
ensure that they pass locally first. See instructions here:
https://docs.openmc.org/en/latest/devguide/tests.html
-->

View file

@ -22,10 +22,10 @@ env:
jobs:
main:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [3.8]
python-version: ["3.11"]
mpi: [n, y]
omp: [n, y]
dagmc: [n]
@ -34,30 +34,30 @@ jobs:
vectfit: [n]
include:
- python-version: 3.6
- python-version: "3.12"
omp: n
mpi: n
- python-version: 3.7
- python-version: "3.13"
omp: n
mpi: n
- dagmc: y
python-version: 3.8
python-version: "3.11"
mpi: y
omp: y
- libmesh: y
python-version: 3.8
python-version: "3.11"
mpi: y
omp: y
- libmesh: y
python-version: 3.8
python-version: "3.11"
mpi: n
omp: y
- event: y
python-version: 3.8
python-version: "3.11"
omp: y
mpi: n
- vectfit: y
python-version: 3.8
python-version: "3.11"
omp: n
mpi: y
name: "Python ${{ matrix.python-version }} (omp=${{ matrix.omp }},
@ -73,62 +73,143 @@ jobs:
EVENT: ${{ matrix.event }}
VECTFIT: ${{ matrix.vectfit }}
LIBMESH: ${{ matrix.libmesh }}
NPY_DISABLE_CPU_FEATURES: "AVX512F AVX512_SKX"
OPENBLAS_NUM_THREADS: 1
PYTEST_ADDOPTS: --cov=openmc --cov-report=lcov:coverage-python.lcov
# libfabric complains about fork() as a result of using Python multiprocessing.
# We can work around it with RDMAV_FORK_SAFE=1 in libfabric < 1.13 and with
# FI_EFA_FORK_SAFE=1 in more recent versions.
RDMAV_FORK_SAFE: 1
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.31'
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Environment Variables
run: |
echo "DAGMC_ROOT=$HOME/DAGMC"
echo "OPENMC_CROSS_SECTIONS=$HOME/nndc_hdf5/cross_sections.xml" >> $GITHUB_ENV
echo "OPENMC_ENDF_DATA=$HOME/endf-b-vii.1" >> $GITHUB_ENV
# get the sha of the last branch commit
# for push and workflow_dispatch events, use the current reference head
BRANCH_SHA=HEAD
# for a pull_request event, use the last reference of the parents of the merge commit
if [ "${{ github.event_name }}" == "pull_request" ]; then
BRANCH_SHA=$(git rev-list --parents -n 1 HEAD | rev | cut -d" " -f 1 | rev)
fi
COMMIT_MESSAGE=$(git log $BRANCH_SHA -1 --pretty=%B | tr '\n' ' ')
echo ${COMMIT_MESSAGE}
echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV
- name: Apt dependencies
shell: bash
run: |
sudo apt -y update
sudo apt install -y libpng-dev \
libmpich-dev \
libnetcdf-dev \
libpnetcdf-dev \
libhdf5-serial-dev \
libhdf5-mpich-dev \
libeigen3-dev
- name: Optional apt dependencies for MPI
shell: bash
if: ${{ matrix.mpi == 'y' }}
run: |
sudo apt install -y libhdf5-mpich-dev \
libmpich-dev
sudo update-alternatives --set mpi /usr/bin/mpicc.mpich
sudo update-alternatives --set mpirun /usr/bin/mpirun.mpich
sudo update-alternatives --set mpi-x86_64-linux-gnu /usr/include/x86_64-linux-gnu/mpich
- name: Optional apt dependencies for vectfit
shell: bash
if: ${{ matrix.vectfit == 'y' }}
run: sudo apt install -y libblas-dev liblapack-dev
- name: install
shell: bash
run: |
echo "$HOME/NJOY2016/build" >> $GITHUB_PATH
$GITHUB_WORKSPACE/tools/ci/gha-install.sh
- name: display-config
shell: bash
run: |
openmc -v
- name: cache-xs
uses: actions/cache@v4
with:
path: |
~/nndc_hdf5
~/endf-b-vii.1
key: ${{ runner.os }}-build-xs-cache
- name: before
shell: bash
run: $GITHUB_WORKSPACE/tools/ci/gha-before-script.sh
- name: test
shell: bash
run: $GITHUB_WORKSPACE/tools/ci/gha-script.sh
run: |
CTEST_OUTPUT_ON_FAILURE=1 make test -C $GITHUB_WORKSPACE/build/
$GITHUB_WORKSPACE/tools/ci/gha-script.sh
- name: after_success
- name: Setup tmate debug session
continue-on-error: true
if: ${{ contains(env.COMMIT_MESSAGE, '[gha-debug]') }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 10
- name: Generate C++ coverage (gcovr)
shell: bash
run: |
cpp-coveralls -i src -i include --exclude-pattern "/usr/*" --dump cpp_cov.json
coveralls --merge=cpp_cov.json --service=github
# Produce LCOV directly from gcov data in the build tree
gcovr \
--root "$GITHUB_WORKSPACE" \
--object-directory "$GITHUB_WORKSPACE/build" \
--filter "$GITHUB_WORKSPACE/src" \
--filter "$GITHUB_WORKSPACE/include" \
--exclude "$GITHUB_WORKSPACE/src/external/.*" \
--exclude "$GITHUB_WORKSPACE/src/include/openmc/external/.*" \
--gcov-ignore-errors source_not_found \
--gcov-ignore-errors output_error \
--gcov-ignore-parse-errors suspicious_hits.warn \
--print-summary \
--lcov -o coverage-cpp.lcov || true
- name: Merge C++ and Python coverage
shell: bash
run: |
# Merge C++ and Python LCOV into a single file for upload
cat coverage-cpp.lcov coverage-python.lcov > coverage.lcov
- name: Upload coverage to Coveralls
if: ${{ hashFiles('coverage.lcov') != '' }}
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
flag-name: C++ and Python
path-to-lcov: coverage.lcov
finish:
needs: main
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

View file

@ -10,20 +10,20 @@ jobs:
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: openmc/openmc:latest-dagmc-libmesh

View file

@ -10,20 +10,20 @@ jobs:
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: openmc/openmc:latest-dagmc

View file

@ -10,20 +10,20 @@ jobs:
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: openmc/openmc:develop

View file

@ -10,20 +10,20 @@ jobs:
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: openmc/openmc:develop-dagmc-libmesh

View file

@ -10,20 +10,20 @@ jobs:
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: openmc/openmc:develop-dagmc

View file

@ -10,20 +10,20 @@ jobs:
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: openmc/openmc:develop-libmesh

View file

@ -10,20 +10,20 @@ jobs:
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: openmc/openmc:latest-libmesh

View file

@ -8,25 +8,25 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: openmc/openmc:${{ env.RELEASE_VERSION }}-dagmc-libmesh

View file

@ -8,25 +8,25 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: openmc/openmc:${{ env.RELEASE_VERSION }}-dagmc

View file

@ -8,25 +8,25 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: openmc/openmc:${{ env.RELEASE_VERSION }}-libmesh

View file

@ -8,25 +8,25 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: openmc/openmc:${{ env.RELEASE_VERSION }}

View file

@ -10,20 +10,20 @@ jobs:
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
-
name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: openmc/openmc:latest

32
.github/workflows/format-check.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: C++ Format Check
on:
# allow workflow to be run manually
workflow_dispatch:
pull_request:
branches:
- develop
- master
jobs:
cpp-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
style: file
files-changed-only: true
tidy-checks: '-*'
version: '15' # clang-format version
file-annotations: true
step-summary: true
extensions: 'cpp,h'
- name: Failure Check
if: steps.linter.outputs.checks-failed > 0
run: echo "Some files failed the formatting check! See job summary and file annotations for more info" && exit 1

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
*.o
*.log
*.out
*.pkl
# Compiler python objects
*.pyc

6
.gitmodules vendored
View file

@ -1,9 +1,6 @@
[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
@ -13,3 +10,6 @@
[submodule "vendor/fmt"]
path = vendor/fmt
url = https://github.com/fmtlib/fmt.git
[submodule "vendor/Catch2"]
path = vendor/Catch2
url = https://github.com/catchorg/Catch2.git

View file

@ -1,13 +1,18 @@
version: 2
build:
os: "ubuntu-20.04"
os: "ubuntu-24.04"
tools:
python: "3.9"
python: "3.12"
jobs:
post_checkout:
- git fetch --unshallow || true
sphinx:
configuration: docs/source/conf.py
python:
install:
- requirements: docs/requirements-rtd.txt
- method: pip
path: .
extra_requirements:
- docs

34
CITATION.cff Normal file
View file

@ -0,0 +1,34 @@
preferred-citation:
authors:
- family-names: Romano
given-names: Paul K.
orcid: "https://orcid.org/0000-0002-1147-045X"
- final-names: Horelik
given-names: Nicholas E.
- family-names: Herman
given-names: Bryan R.
- family-names: Nelson
given-names: Adam G.
orcid: "https://orcid.org/0000-0002-3614-0676"
- family-names: Forget
given-names: Benoit
orcid: "https://orcid.org/0000-0003-1459-7672"
- family-names: Smith
given-names: Kord
contact:
- family-names: Romano
given-names: Paul K.
orcid: "https://orcid.org/0000-0002-1147-045X"
doi: 10.1016/j.anucene.2014.07.048
issn: 0306-4549
volume: 82
journal: Annals of Nuclear Energy
publisher:
name: Elsevier
start: 90
end: 97
year: 2015
month: 8
title: "OpenMC: A state-of-the-art Monte Carlo code for research and development"
type: article
url: "https://doi.org/10.1016/j.anucene.2014.07.048"

View file

@ -1,11 +1,18 @@
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
project(openmc C CXX)
# Set version numbers
set(OPENMC_VERSION_MAJOR 0)
set(OPENMC_VERSION_MINOR 13)
set(OPENMC_VERSION_RELEASE 0)
set(OPENMC_VERSION ${OPENMC_VERSION_MAJOR}.${OPENMC_VERSION_MINOR}.${OPENMC_VERSION_RELEASE})
# Set module path
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
include(GetVersionFromGit)
# Output version information
message(STATUS "OpenMC version: ${OPENMC_VERSION}")
message(STATUS "OpenMC dev state: ${OPENMC_DEV_STATE}")
message(STATUS "OpenMC commit hash: ${OPENMC_COMMIT_HASH}")
message(STATUS "OpenMC commit count: ${OPENMC_COMMIT_COUNT}")
# Generate version.h
configure_file(include/openmc/version.h.in "${CMAKE_BINARY_DIR}/include/openmc/version.h" @ONLY)
# Setup output directories
@ -13,75 +20,134 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Set module path
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
# Allow user to specify <project>_ROOT variables
if (NOT (CMAKE_VERSION VERSION_LESS 3.12))
cmake_policy(SET CMP0074 NEW)
# Enable correct usage of CXX_EXTENSIONS
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.22)
cmake_policy(SET CMP0128 NEW)
endif()
#===============================================================================
# Command line options
#===============================================================================
option(openmp "Enable shared-memory parallelism with OpenMP" ON)
option(profile "Compile with profiling flags" OFF)
option(debug "Compile with debug flags" OFF)
option(optimize "Turn on all compiler optimization flags" OFF)
option(coverage "Compile with coverage analysis flags" OFF)
option(dagmc "Enable support for DAGMC (CAD) geometry" OFF)
option(libmesh "Enable support for libMesh unstructured mesh tallies" OFF)
option(OPENMC_USE_OPENMP "Enable shared-memory parallelism with OpenMP" ON)
option(OPENMC_BUILD_TESTS "Build tests" ON)
option(OPENMC_ENABLE_PROFILE "Compile with profiling flags" OFF)
option(OPENMC_ENABLE_COVERAGE "Compile with coverage analysis flags" OFF)
option(OPENMC_USE_DAGMC "Enable support for DAGMC (CAD) geometry" OFF)
option(OPENMC_USE_LIBMESH "Enable support for libMesh unstructured mesh tallies" OFF)
option(OPENMC_USE_MPI "Enable MPI" OFF)
option(OPENMC_USE_UWUW "Enable UWUW" OFF)
option(OPENMC_FORCE_VENDORED_LIBS "Explicitly use submodules defined in 'vendor'" OFF)
message(STATUS "OPENMC_USE_OPENMP ${OPENMC_USE_OPENMP}")
message(STATUS "OPENMC_BUILD_TESTS ${OPENMC_BUILD_TESTS}")
message(STATUS "OPENMC_ENABLE_PROFILE ${OPENMC_ENABLE_PROFILE}")
message(STATUS "OPENMC_ENABLE_COVERAGE ${OPENMC_ENABLE_COVERAGE}")
message(STATUS "OPENMC_USE_DAGMC ${OPENMC_USE_DAGMC}")
message(STATUS "OPENMC_USE_LIBMESH ${OPENMC_USE_LIBMESH}")
message(STATUS "OPENMC_USE_MPI ${OPENMC_USE_MPI}")
message(STATUS "OPENMC_USE_UWUW ${OPENMC_USE_UWUW}")
message(STATUS "OPENMC_FORCE_VENDORED_LIBS ${OPENMC_FORCE_VENDORED_LIBS}")
# Warnings for deprecated options
foreach(OLD_OPT IN ITEMS "openmp" "profile" "coverage" "dagmc" "libmesh")
if(DEFINED ${OLD_OPT})
string(TOUPPER ${OLD_OPT} OPT_UPPER)
if ("${OLD_OPT}" STREQUAL "profile" OR "${OLD_OPT}" STREQUAL "coverage")
set(NEW_OPT_PREFIX "OPENMC_ENABLE")
else()
set(NEW_OPT_PREFIX "OPENMC_USE")
endif()
message(WARNING "The OpenMC CMake option '${OLD_OPT}' has been deprecated. "
"Its value will be ignored. "
"Please use '-D${NEW_OPT_PREFIX}_${OPT_UPPER}=${${OLD_OPT}}' instead.")
unset(${OLD_OPT} CACHE)
endif()
endforeach()
foreach(OLD_BLD in ITEMS "debug" "optimize")
if(DEFINED ${OLD_BLD})
if("${OLD_BLD}" STREQUAL "debug")
set(BLD_VAR "Debug")
else()
set(BLD_VAR "Release")
endif()
message(WARNING "The OpenMC CMake option '${OLD_BLD}' has been deprecated. "
"Its value will be ignored. "
"OpenMC now uses the CMAKE_BUILD_TYPE variable to set the build mode. "
"Please use '-DCMAKE_BUILD_TYPE=${BLD_VAR}' instead.")
unset(${OLD_BLD} CACHE)
endif()
endforeach()
#===============================================================================
# Set a default build configuration if not explicitly specified
#===============================================================================
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, defaulting to RelWithDebInfo")
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build" FORCE)
endif()
#===============================================================================
# OpenMP for shared-memory parallelism (and GPU support some day!)
#===============================================================================
if(OPENMC_USE_OPENMP)
find_package(OpenMP REQUIRED)
endif()
#===============================================================================
# MPI for distributed-memory parallelism
#===============================================================================
set(MPI_ENABLED FALSE)
if(${CMAKE_CXX_COMPILER} MATCHES "(mpi[^/]*|CC)$")
message(STATUS "Detected MPI wrapper: ${CMAKE_CXX_COMPILER}")
set(MPI_ENABLED TRUE)
if(OPENMC_USE_MPI)
find_package(MPI REQUIRED)
endif()
#===============================================================================
# Helper macro for finding a dependency
#===============================================================================
macro(find_package_write_status pkg)
find_package(${pkg} QUIET NO_SYSTEM_ENVIRONMENT_PATH)
if(${pkg}_FOUND)
message(STATUS "Found ${pkg}: ${${pkg}_DIR} (version ${${pkg}_VERSION})")
else()
message(STATUS "Did not find ${pkg}, will use submodule instead")
endif()
endmacro()
#===============================================================================
# DAGMC Geometry Support - need DAGMC/MOAB
#===============================================================================
if(dagmc)
if(OPENMC_USE_DAGMC)
find_package(DAGMC REQUIRED PATH_SUFFIXES lib/cmake)
if (${DAGMC_VERSION} VERSION_LESS 3.2.0)
message(FATAL_ERROR "Discovered DAGMC Version: ${DAGMC_VERSION}. \
Please update DAGMC to version 3.2.0 or greater.")
message(FATAL_ERROR "Discovered DAGMC Version: ${DAGMC_VERSION}."
"Please update DAGMC to version 3.2.0 or greater.")
endif()
endif()
message(STATUS "Found DAGMC: ${DAGMC_DIR} (version ${DAGMC_VERSION})")
#===============================================================================
# Check for submodules perhaps already on system
#===============================================================================
# If not found, we just pull appropriate versions from github and build them.
find_package(fmt QUIET NO_SYSTEM_ENVIRONMENT_PATH)
if(fmt_FOUND)
message(STATUS "Found fmt: ${fmt_DIR} (version ${fmt_VERSION})")
else()
message(STATUS "Did not find fmt, will use submodule instead")
endif()
find_package(pugixml QUIET NO_SYSTEM_ENVIRONMENT_PATH)
if(pugixml_FOUND)
message(STATUS "Found pugixml: ${pugixml_DIR}")
else()
message(STATUS "Did not find pugixml, will use submodule instead")
# Check if UWUW is needed and available
if(OPENMC_USE_UWUW AND NOT DAGMC_BUILD_UWUW)
message(FATAL_ERROR "UWUW is enabled but DAGMC was not configured with UWUW.")
endif()
endif()
#===============================================================================
# libMesh Unstructured Mesh Support
#===============================================================================
if(libmesh)
if(OPENMC_USE_LIBMESH)
find_package(LIBMESH REQUIRED)
endif()
#===============================================================================
# libpng
#===============================================================================
find_package(PNG)
#===============================================================================
@ -102,11 +168,16 @@ if(NOT DEFINED HDF5_PREFER_PARALLEL)
endif()
find_package(HDF5 REQUIRED COMPONENTS C HL)
# Remove HDF5 transitive dependencies that are system libraries
list(FILTER HDF5_LIBRARIES EXCLUDE REGEX ".*lib(pthread|dl|m).*")
message(STATUS "HDF5 Libraries: ${HDF5_LIBRARIES}")
if(HDF5_IS_PARALLEL)
if(NOT MPI_ENABLED)
message(FATAL_ERROR "Parallel HDF5 was detected, but the detected compiler,\
${CMAKE_CXX_COMPILER}, does not support MPI. An MPI-capable compiler must \
be used with parallel HDF5.")
if(NOT OPENMC_USE_MPI)
message(FATAL_ERROR "Parallel HDF5 was detected, but MPI was not enabled.\
To use parallel HDF5, OpenMC needs to be built with MPI support by passing\
-DOPENMC_USE_MPI=ON when calling cmake.")
endif()
message(STATUS "Using parallel HDF5")
endif()
@ -114,7 +185,7 @@ endif()
# Version 1.12 of HDF5 deprecates the H5Oget_info_by_idx() interface.
# Thus, we give these flags to allow usage of the old interface in newer
# versions of HDF5.
if(NOT (${HDF5_VERSION} VERSION_LESS 1.12.0))
if(${HDF5_VERSION} VERSION_GREATER_EQUAL 1.12.0)
list(APPEND cxxflags -DH5Oget_info_by_idx_vers=1 -DH5O_info_t_vers=1)
endif()
@ -125,30 +196,13 @@ endif()
# Skip for Visual Studio which has its own configurations through GUI
if(NOT MSVC)
if(openmp)
# Requires CMake 3.1+
find_package(OpenMP)
if(OPENMP_FOUND)
list(APPEND cxxflags ${OpenMP_CXX_FLAGS})
list(APPEND ldflags ${OpenMP_CXX_FLAGS})
endif()
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
list(APPEND cxxflags -O2)
if(debug)
list(REMOVE_ITEM cxxflags -O2)
list(APPEND cxxflags -g -O0)
endif()
if(profile)
if(OPENMC_ENABLE_PROFILE)
list(APPEND cxxflags -g -fno-omit-frame-pointer)
endif()
if(optimize)
list(REMOVE_ITEM cxxflags -O2)
list(APPEND cxxflags -O3)
endif()
if(coverage)
if(OPENMC_ENABLE_COVERAGE)
list(APPEND cxxflags --coverage)
list(APPEND ldflags --coverage)
endif()
@ -162,8 +216,6 @@ 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)
@ -188,42 +240,63 @@ endif()
# pugixml library
#===============================================================================
if (NOT pugixml_FOUND)
if(OPENMC_FORCE_VENDORED_LIBS)
add_subdirectory(vendor/pugixml)
set_target_properties(pugixml PROPERTIES CXX_STANDARD 14 CXX_EXTENSIONS OFF)
else()
find_package_write_status(pugixml)
if (NOT pugixml_FOUND)
add_subdirectory(vendor/pugixml)
set_target_properties(pugixml PROPERTIES CXX_STANDARD 14 CXX_EXTENSIONS OFF)
endif()
endif()
#===============================================================================
# {fmt} library
#===============================================================================
if (NOT fmt_FOUND)
if(OPENMC_FORCE_VENDORED_LIBS)
set(FMT_INSTALL ON CACHE BOOL "Generate the install target.")
add_subdirectory(vendor/fmt)
else()
find_package_write_status(fmt)
if (NOT fmt_FOUND)
set(FMT_INSTALL ON CACHE BOOL "Generate the install target.")
add_subdirectory(vendor/fmt)
endif()
endif()
#===============================================================================
# xtensor header-only library
#===============================================================================
# CMake 3.13+ will complain about policy CMP0079 unless it is set explicitly
if (NOT (CMAKE_VERSION VERSION_LESS 3.13))
cmake_policy(SET CMP0079 NEW)
if(OPENMC_FORCE_VENDORED_LIBS)
add_subdirectory(vendor/xtl)
set(xtl_DIR ${CMAKE_CURRENT_BINARY_DIR}/vendor/xtl)
add_subdirectory(vendor/xtensor)
else()
find_package_write_status(xtensor)
if (NOT xtensor_FOUND)
add_subdirectory(vendor/xtl)
set(xtl_DIR ${CMAKE_CURRENT_BINARY_DIR}/vendor/xtl)
add_subdirectory(vendor/xtensor)
endif()
endif()
add_subdirectory(vendor/xtl)
set(xtl_DIR ${CMAKE_CURRENT_BINARY_DIR}/vendor/xtl)
add_subdirectory(vendor/xtensor)
#===============================================================================
# GSL header-only library
# Catch2 library
#===============================================================================
add_subdirectory(vendor/gsl-lite)
# Make sure contract violations throw exceptions
target_compile_definitions(gsl-lite-v1 INTERFACE GSL_THROW_ON_CONTRACT_VIOLATION)
target_compile_definitions(gsl-lite-v1 INTERFACE gsl_CONFIG_ALLOWS_NONSTRICT_SPAN_COMPARISON=1)
if(OPENMC_BUILD_TESTS)
if (OPENMC_FORCE_VENDORED_LIBS)
add_subdirectory(vendor/Catch2)
else()
find_package_write_status(Catch2)
if (NOT Catch2_FOUND)
add_subdirectory(vendor/Catch2)
endif()
endif()
endif()
#===============================================================================
# RPATH information
@ -254,18 +327,6 @@ if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
endif()
#===============================================================================
# faddeeva library
#===============================================================================
add_library(faddeeva STATIC vendor/faddeeva/Faddeeva.cc)
target_include_directories(faddeeva
PUBLIC
$<INSTALL_INTERFACE:include/faddeeva>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/vendor/faddeeva>
)
target_compile_options(faddeeva PRIVATE ${cxxflags})
#===============================================================================
# libopenmc
#===============================================================================
@ -274,10 +335,11 @@ list(APPEND libopenmc_SOURCES
src/bank.cpp
src/boundary_condition.cpp
src/bremsstrahlung.cpp
src/dagmc.cpp
src/cell.cpp
src/chain.cpp
src/cmfd_solver.cpp
src/cross_sections.cpp
src/dagmc.cpp
src/distribution.cpp
src/distribution_angle.cpp
src/distribution_energy.cpp
@ -287,18 +349,23 @@ list(APPEND libopenmc_SOURCES
src/endf.cpp
src/error.cpp
src/event.cpp
src/initialize.cpp
src/file_utils.cpp
src/finalize.cpp
src/geometry.cpp
src/geometry_aux.cpp
src/hdf5_interface.cpp
src/ifp.cpp
src/initialize.cpp
src/lattice.cpp
src/material.cpp
src/math_functions.cpp
src/mcpl_interface.cpp
src/mesh.cpp
src/message_passing.cpp
src/mgxs.cpp
src/mgxs_interface.cpp
src/ncrystal_interface.cpp
src/ncrystal_load.cpp
src/nuclide.cpp
src/output.cpp
src/particle.cpp
@ -313,6 +380,12 @@ list(APPEND libopenmc_SOURCES
src/progress_bar.cpp
src/random_dist.cpp
src/random_lcg.cpp
src/random_ray/random_ray_simulation.cpp
src/random_ray/random_ray.cpp
src/random_ray/flat_source_domain.cpp
src/random_ray/linear_source_domain.cpp
src/random_ray/moment_matrix.cpp
src/random_ray/source_region.cpp
src/reaction.cpp
src/reaction_product.cpp
src/scattdata.cpp
@ -331,20 +404,25 @@ list(APPEND libopenmc_SOURCES
src/tallies/derivative.cpp
src/tallies/filter.cpp
src/tallies/filter_azimuthal.cpp
src/tallies/filter_cellborn.cpp
src/tallies/filter_cellfrom.cpp
src/tallies/filter_cell.cpp
src/tallies/filter_cell_instance.cpp
src/tallies/filter_cellborn.cpp
src/tallies/filter_cellfrom.cpp
src/tallies/filter_collision.cpp
src/tallies/filter_delayedgroup.cpp
src/tallies/filter_distribcell.cpp
src/tallies/filter_energyfunc.cpp
src/tallies/filter_energy.cpp
src/tallies/filter_collision.cpp
src/tallies/filter_energyfunc.cpp
src/tallies/filter_legendre.cpp
src/tallies/filter_material.cpp
src/tallies/filter_materialfrom.cpp
src/tallies/filter_mesh.cpp
src/tallies/filter_meshborn.cpp
src/tallies/filter_meshmaterial.cpp
src/tallies/filter_meshsurface.cpp
src/tallies/filter_mu.cpp
src/tallies/filter_musurface.cpp
src/tallies/filter_parent_nuclide.cpp
src/tallies/filter_particle.cpp
src/tallies/filter_polar.cpp
src/tallies/filter_sph_harm.cpp
@ -352,13 +430,15 @@ list(APPEND libopenmc_SOURCES
src/tallies/filter_surface.cpp
src/tallies/filter_time.cpp
src/tallies/filter_universe.cpp
src/tallies/filter_weight.cpp
src/tallies/filter_zernike.cpp
src/tallies/tally.cpp
src/tallies/tally_scoring.cpp
src/tallies/trigger.cpp
src/timer.cpp
src/thermal.cpp
src/timer.cpp
src/track_output.cpp
src/universe.cpp
src/urr.cpp
src/volume_calc.cpp
src/weight_windows.cpp
@ -368,7 +448,8 @@ list(APPEND libopenmc_SOURCES
# Add bundled external dependencies
list(APPEND libopenmc_SOURCES
src/external/quartic_solver.cpp)
src/external/quartic_solver.cpp
src/external/Faddeeva.cc)
# For Visual Studio compilers
if(MSVC)
@ -382,6 +463,8 @@ else()
add_library(libopenmc SHARED ${libopenmc_SOURCES})
endif()
add_library(OpenMC::libopenmc ALIAS libopenmc)
# Avoid vs error lnk1149 :output filename matches input filename
if(NOT MSVC)
set_target_properties(libopenmc PROPERTIES OUTPUT_NAME openmc)
@ -398,39 +481,42 @@ target_include_directories(libopenmc
target_compile_options(libopenmc PRIVATE ${cxxflags})
# Add include directory for configured version file
target_include_directories(libopenmc PRIVATE ${CMAKE_BINARY_DIR}/include)
target_include_directories(libopenmc
PUBLIC $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>)
if (HDF5_IS_PARALLEL)
target_compile_definitions(libopenmc PRIVATE -DPHDF5)
endif()
if (MPI_ENABLED)
if (OPENMC_USE_MPI)
target_compile_definitions(libopenmc PUBLIC -DOPENMC_MPI)
endif()
# Set git SHA1 hash as a compile definition
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-lite-v1 fmt::fmt)
xtensor fmt::fmt ${CMAKE_DL_LIBS})
if(dagmc)
target_compile_definitions(libopenmc PRIVATE DAGMC)
target_link_libraries(libopenmc dagmc-shared uwuw-shared)
if(TARGET pugixml::pugixml)
target_link_libraries(libopenmc pugixml::pugixml)
else()
target_link_libraries(libopenmc pugixml)
endif()
if(libmesh)
target_compile_definitions(libopenmc PRIVATE LIBMESH)
if(OPENMC_USE_DAGMC)
target_compile_definitions(libopenmc PRIVATE OPENMC_DAGMC_ENABLED)
target_link_libraries(libopenmc dagmc-shared)
if(OPENMC_USE_UWUW)
target_compile_definitions(libopenmc PRIVATE OPENMC_UWUW_ENABLED)
target_link_libraries(libopenmc uwuw-shared)
endif()
elseif(OPENMC_USE_UWUW)
set(OPENMC_USE_UWUW OFF)
message(FATAL_ERROR "DAGMC must be enabled when UWUW is enabled.")
endif()
if(OPENMC_USE_LIBMESH)
target_compile_definitions(libopenmc PRIVATE OPENMC_LIBMESH_ENABLED)
target_link_libraries(libopenmc PkgConfig::LIBMESH)
endif()
@ -439,19 +525,46 @@ if (PNG_FOUND)
target_link_libraries(libopenmc PNG::PNG)
endif()
if (OPENMC_USE_OPENMP)
target_link_libraries(libopenmc OpenMP::OpenMP_CXX)
endif()
if (OPENMC_USE_MPI)
target_link_libraries(libopenmc MPI::MPI_CXX)
endif()
if (OPENMC_BUILD_TESTS)
# Add cpp tests directory
include(CTest)
add_subdirectory(tests/cpp_unit_tests)
endif()
#===============================================================================
# Log build info that this executable can report later
#===============================================================================
target_compile_definitions(libopenmc PRIVATE BUILD_TYPE=${CMAKE_BUILD_TYPE})
target_compile_definitions(libopenmc PRIVATE COMPILER_ID=${CMAKE_CXX_COMPILER_ID})
target_compile_definitions(libopenmc PRIVATE COMPILER_VERSION=${CMAKE_CXX_COMPILER_VERSION})
if (OPENMC_ENABLE_PROFILE)
target_compile_definitions(libopenmc PRIVATE PROFILINGBUILD)
endif()
if (OPENMC_ENABLE_COVERAGE)
target_compile_definitions(libopenmc PRIVATE COVERAGEBUILD)
endif()
#===============================================================================
# openmc executable
#===============================================================================
add_executable(openmc src/main.cpp)
add_executable(OpenMC::openmc ALIAS openmc)
target_compile_options(openmc PRIVATE ${cxxflags})
target_include_directories(openmc PRIVATE ${CMAKE_BINARY_DIR}/include)
target_link_libraries(openmc libopenmc)
# Ensure C++14 standard is used. Starting with CMake 3.8, another way this could
# be done is using the cxx_std_14 compiler feature.
set_target_properties(
openmc libopenmc faddeeva
PROPERTIES CXX_STANDARD 14 CXX_EXTENSIONS OFF)
# Ensure C++17 standard is used and turn off GNU extensions
target_compile_features(openmc PUBLIC cxx_std_17)
target_compile_features(libopenmc PUBLIC cxx_std_17)
set_target_properties(openmc libopenmc PROPERTIES CXX_EXTENSIONS OFF)
#===============================================================================
# Python package
@ -471,7 +584,7 @@ configure_file(cmake/OpenMCConfig.cmake.in "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIR
configure_file(cmake/OpenMCConfigVersion.cmake.in "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMCConfigVersion.cmake" @ONLY)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/OpenMC)
install(TARGETS openmc libopenmc faddeeva
install(TARGETS openmc libopenmc
EXPORT openmc-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@ -482,7 +595,6 @@ install(EXPORT openmc-targets
NAMESPACE OpenMC::
DESTINATION ${INSTALL_CONFIGDIR})
install(DIRECTORY src/relaxng DESTINATION ${CMAKE_INSTALL_DATADIR}/openmc)
install(FILES
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMCConfig.cmake"
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMCConfigVersion.cmake"
@ -491,7 +603,3 @@ 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})
install(FILES "${CMAKE_BINARY_DIR}/include/openmc/version.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/openmc)
# 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})

View file

@ -5,9 +5,9 @@ openmc/data/ @paulromano
openmc/lib/ @paulromano
# Depletion
openmc/deplete/ @drewejohnson
tests/regression_tests/deplete/ @drewejohnson
tests/unit_tests/test_deplete_*.py @drewejohnson
openmc/deplete/ @paulromano
tests/regression_tests/deplete/ @paulromano
tests/unit_tests/test_deplete_*.py @paulromano
# MG-related functionality
openmc/mgxs_library.py @nelsonag
@ -26,6 +26,12 @@ src/dagmc.cpp @pshriwise
tests/regression_tests/dagmc/ @pshriwise
tests/unit_tests/dagmc/ @pshriwise
# Weight windows
openmc/weight_windows.py @pshriwise
openmc/lib/weight_windows.py @pshriwise
src/weight_windows.py @pshriwise
tests/unit_tests/weightwindows/ @pshriwise
# Photon transport
openmc/data/BREMX.DAT @amandalund
openmc/data/compton_profiles.h5 @amandalund
@ -46,3 +52,16 @@ openmc/lib/plot.py @pshriwise
# Resonance covariance
openmc/data/resonance_covariance.py @icmeyer
# Docker
Dockerfile @shimwell
# Random ray
src/random_ray/ @jtramm
# NCrystal interface
src/ncrystal_interface.cpp @marquezj @tkittel
src/ncrystal_load.cpp @marquezj @tkittel
# MCPL interface
src/mcpl_interface.cpp @ebknudsen

View file

@ -13,7 +13,7 @@ openmc@anl.gov.
## Resources
- [GitHub Repository](https://github.com/openmc-dev/openmc)
- [Documentation](http://docs.openmc.org/en/latest)
- [Documentation](https://docs.openmc.org/en/latest)
- [Discussion Forum](https://openmc.discourse.group)
- [Slack Community](https://openmc.slack.com/signup) (If you don't see your
domain listed, contact openmc@anl.gov)

View file

@ -15,50 +15,53 @@
# sudo docker run image_name:tag_name or ID with no tag sudo docker run ID number
FROM debian:bullseye-slim
# global ARG as these ARGS are used in multiple stages
# By default one core is used to compile
ARG compile_cores=1
# By default this Dockerfile builds OpenMC without DAGMC and LIBMESH support
ARG build_dagmc=off
ARG build_libmesh=off
# By default one core is used to compile
ARG compile_cores=1
FROM ubuntu:24.04 AS dependencies
ARG compile_cores
ARG build_dagmc
ARG build_libmesh
# Set default value of HOME to /root
ENV HOME=/root
# OpenMC variables
ARG openmc_branch=master
ENV OPENMC_REPO='https://github.com/openmc-dev/openmc'
# Embree variables
ENV EMBREE_TAG='v3.12.2'
ENV EMBREE_TAG='v4.3.1'
ENV EMBREE_REPO='https://github.com/embree/embree'
ENV EMBREE_INSTALL_DIR=$HOME/EMBREE/
# MOAB variables
ENV MOAB_TAG='5.3.0'
ENV MOAB_TAG='5.5.1'
ENV MOAB_REPO='https://bitbucket.org/fathomteam/moab/'
# Double-Down variables
ENV DD_TAG='v1.0.0'
ENV DD_TAG='v1.1.0'
ENV DD_REPO='https://github.com/pshriwise/double-down'
ENV DD_INSTALL_DIR=$HOME/Double_down
# DAGMC variables
ENV DAGMC_BRANCH='develop'
ENV DAGMC_BRANCH='v3.2.4'
ENV DAGMC_REPO='https://github.com/svalinn/DAGMC'
ENV DAGMC_INSTALL_DIR=$HOME/DAGMC/
# LIBMESH variables
ENV LIBMESH_TAG='v1.6.0'
ENV LIBMESH_TAG='v1.7.1'
ENV LIBMESH_REPO='https://github.com/libMesh/libmesh'
ENV LIBMESH_INSTALL_DIR=$HOME/LIBMESH
# NJOY variables
ENV NJOY_REPO='https://github.com/njoy/NJOY2016'
# Setup environment variables for Docker image
ENV CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \
LD_LIBRARY_PATH=${DAGMC_INSTALL_DIR}/lib:$LD_LIBRARY_PATH \
OPENMC_CROSS_SECTIONS=/root/nndc_hdf5/cross_sections.xml \
ENV LD_LIBRARY_PATH=${DAGMC_INSTALL_DIR}/lib:$LD_LIBRARY_PATH \
OPENMC_ENDF_DATA=/root/endf-b-vii.1 \
DEBIAN_FRONTEND=noninteractive
@ -68,23 +71,32 @@ RUN apt-get update -y && \
apt-get install -y \
python3-pip python-is-python3 wget git build-essential cmake \
mpich libmpich-dev libhdf5-serial-dev libhdf5-mpich-dev \
libpng-dev && \
libpng-dev python3-venv && \
apt-get autoremove
# create virtual enviroment to avoid externally managed environment error
RUN python3 -m venv openmc_venv
ENV PATH=/openmc_venv/bin:$PATH
# Update system-provided pip
RUN pip install --upgrade pip
# Clone and install NJOY2016
RUN cd $HOME && git clone --depth 1 https://github.com/njoy/NJOY2016.git && \
cd NJOY2016 && mkdir build && cd build && \
cmake -Dstatic=on .. && make 2>/dev/null -j${compile_cores} install && \
rm -rf $HOME/NJOY2016
RUN cd $HOME \
&& git clone --single-branch --depth 1 ${NJOY_REPO} \
&& cd NJOY2016 \
&& mkdir build \
&& cd build \
&& cmake -Dstatic=on .. \
&& make 2>/dev/null -j${compile_cores} install \
&& rm -rf $HOME/NJOY2016
RUN if [ "$build_dagmc" = "on" ]; then \
# Install addition packages required for DAGMC
apt-get -y install libeigen3-dev libnetcdf-dev libtbb-dev libglfw3-dev \
&& pip install --upgrade numpy cython \
&& pip install --upgrade numpy \
&& pip install --no-cache-dir setuptools cython \
# Clone and install EMBREE
&& mkdir -p $HOME/EMBREE && cd $HOME/EMBREE \
&& git clone --single-branch -b ${EMBREE_TAG} --depth 1 ${EMBREE_REPO} \
@ -100,7 +112,8 @@ RUN if [ "$build_dagmc" = "on" ]; then \
mkdir -p $HOME/MOAB && cd $HOME/MOAB \
&& git clone --single-branch -b ${MOAB_TAG} --depth 1 ${MOAB_REPO} \
&& mkdir build && cd build \
&& cmake ../moab -DENABLE_HDF5=ON \
&& cmake ../moab -DCMAKE_BUILD_TYPE=Release \
-DENABLE_HDF5=ON \
-DENABLE_NETCDF=ON \
-DBUILD_SHARED_LIBS=OFF \
-DENABLE_FORTRAN=OFF \
@ -112,6 +125,7 @@ RUN if [ "$build_dagmc" = "on" ]; then \
&& make 2>/dev/null -j${compile_cores} install \
&& cd pymoab && bash install.sh \
&& python setup.py install \
&& python -c "import pymoab" \
&& rm -rf $HOME/MOAB ; \
# Clone and install Double-Down
mkdir -p $HOME/Double_down && cd $HOME/Double_down \
@ -165,43 +179,63 @@ RUN if [ "$build_libmesh" = "on" ]; then \
&& rm -rf ${LIBMESH_INSTALL_DIR}/build ${LIBMESH_INSTALL_DIR}/libmesh ; \
fi
FROM dependencies AS build
ENV HOME=/root
ARG openmc_branch=master
ENV OPENMC_REPO='https://github.com/openmc-dev/openmc'
ARG compile_cores
ARG build_dagmc
ARG build_libmesh
ENV DAGMC_INSTALL_DIR=$HOME/DAGMC/
ENV LIBMESH_INSTALL_DIR=$HOME/LIBMESH
# clone and install openmc
RUN mkdir -p ${HOME}/OpenMC && cd ${HOME}/OpenMC \
&& git clone --shallow-submodules --recurse-submodules -b ${openmc_branch} --depth=1 ${OPENMC_REPO} \
&& git clone --shallow-submodules --recurse-submodules --single-branch -b ${openmc_branch} ${OPENMC_REPO} \
&& mkdir build && cd build ; \
if [ ${build_dagmc} = "on" ] && [ ${build_libmesh} = "on" ]; then \
cmake ../openmc \
-Doptimize=off \
-Ddebug=off \
-DCMAKE_CXX_COMPILER=mpicxx \
-DOPENMC_USE_MPI=on \
-DHDF5_PREFER_PARALLEL=on \
-Ddagmc=on \
-Dlibmesh=on \
-DOPENMC_USE_DAGMC=on \
-DOPENMC_USE_LIBMESH=on \
-DCMAKE_PREFIX_PATH="${DAGMC_INSTALL_DIR};${LIBMESH_INSTALL_DIR}" ; \
fi ; \
if [ ${build_dagmc} = "on" ] && [ ${build_libmesh} = "off" ]; then \
cmake ../openmc \
-Doptimize=off \
-Ddebug=off \
-DCMAKE_CXX_COMPILER=mpicxx \
-DOPENMC_USE_MPI=on \
-DHDF5_PREFER_PARALLEL=on \
-Ddagmc=ON \
-DOPENMC_USE_DAGMC=ON \
-DCMAKE_PREFIX_PATH=${DAGMC_INSTALL_DIR} ; \
fi ; \
if [ ${build_dagmc} = "off" ] && [ ${build_libmesh} = "on" ]; then \
cmake ../openmc \
-Doptimize=off \
-Ddebug=off \
-DCMAKE_CXX_COMPILER=mpicxx \
-DOPENMC_USE_MPI=on \
-DHDF5_PREFER_PARALLEL=on \
-Dlibmesh=on \
-DOPENMC_USE_LIBMESH=on \
-DCMAKE_PREFIX_PATH=${LIBMESH_INSTALL_DIR} ; \
fi ; \
if [ ${build_dagmc} = "off" ] && [ ${build_libmesh} = "off" ]; then \
cmake ../openmc \
-Doptimize=off \
-Ddebug=off \
-DCMAKE_CXX_COMPILER=mpicxx \
-DOPENMC_USE_MPI=on \
-DHDF5_PREFER_PARALLEL=on ; \
fi ; \
make 2>/dev/null -j${compile_cores} install \
&& cd ../openmc && pip install -e .[test,depletion-mpi]
&& cd ../openmc && pip install .[test,depletion-mpi] \
&& python -c "import openmc"
FROM build AS release
ENV HOME=/root
ENV OPENMC_CROSS_SECTIONS=/root/nndc_hdf5/cross_sections.xml
# Download cross sections (NNDC and WMP) and ENDF data needed by test suite
RUN ${HOME}/OpenMC/openmc/tools/ci/download-xs.sh

View file

@ -1,4 +1,4 @@
Copyright (c) 2011-2022 Massachusetts Institute of Technology, UChicago Argonne
Copyright (c) 2011-2025 Massachusetts Institute of Technology, UChicago Argonne
LLC, and OpenMC contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of

View file

@ -8,7 +8,6 @@ include schemas.xml
include pyproject.toml
include pytest.ini
include docs/source/_templates/layout.html
include docs/sphinxext/LICENSE
global-include *.cmake
global-include *.cmake.in
global-include *.rst
@ -20,25 +19,20 @@ recursive-include docs *.svg
recursive-include docs *.tex
recursive-include docs *.txt
recursive-include docs Makefile
recursive-include examples *.h5
recursive-include examples *.png
recursive-include examples *.cpp
recursive-include examples *.py
recursive-include examples *.xml
recursive-include include *.h
recursive-include include *.h.in
recursive-include include *.hh
recursive-include man *.1
recursive-inlcude openmc *.pyx
recursive-include openmc *.c
recursive-include src *.c
recursive-include src *.cc
recursive-include src *.cpp
recursive-include src *.h
recursive-include src *.hpp
recursive-include src *.rnc
recursive-include src *.rng
recursive-include tests *.dat
recursive-include tests *.h5
recursive-inlcude tests *.h5m
recursive-include tests *.h5m
recursive-include tests *.py
recursive-include tests *.xml
recursive-include vendor CMakeLists.txt
@ -49,6 +43,5 @@ recursive-include vendor *.hh
recursive-include vendor *.hpp
recursive-include vendor *.pc.in
recursive-include vendor *.natvis
include vendor/gsl-lite/include/gsl/gsl
prune docs/build
prune docs/source/pythonapi/generated/

View file

@ -1,10 +1,11 @@
# OpenMC Monte Carlo Particle Transport Code
[![License](https://img.shields.io/badge/license-MIT-green)](https://docs.openmc.org/en/latest/license.html)
[![GitHub Actions build status (Linux)](https://github.com/openmc-dev/openmc/workflows/CI/badge.svg?branch=develop)](https://github.com/openmc-dev/openmc/actions?query=workflow%3ACI)
[![GitHub Actions build status (Linux)](https://github.com/openmc-dev/openmc/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/openmc-dev/openmc/actions/workflows/ci.yml)
[![Code Coverage](https://coveralls.io/repos/github/openmc-dev/openmc/badge.svg?branch=develop)](https://coveralls.io/github/openmc-dev/openmc?branch=develop)
[![dockerhub-publish-develop-dagmc](https://github.com/openmc-dev/openmc/workflows/dockerhub-publish-develop-dagmc/badge.svg)](https://github.com/openmc-dev/openmc/actions?query=workflow%3Adockerhub-publish-develop-dagmc)
[![dockerhub-publish-develop](https://github.com/openmc-dev/openmc/workflows/dockerhub-publish-develop/badge.svg)](https://github.com/openmc-dev/openmc/actions?query=workflow%3Adockerhub-publish-develop)
[![conda-pacakge](https://anaconda.org/conda-forge/openmc/badges/version.svg)](https://anaconda.org/conda-forge/openmc)
The OpenMC project aims to provide a fully-featured Monte Carlo particle
transport code based on modern methods. It is a constructive solid geometry,
@ -14,7 +15,8 @@ project started under the Computational Reactor Physics Group at MIT.
Complete documentation on the usage of OpenMC is hosted on Read the Docs (both
for the [latest release](https://docs.openmc.org/en/stable/) and
[developmental](https://docs.openmc.org/en/latest/) version). If you are
interested in the project, or would like to help and contribute, please get in touch on the OpenMC [discussion forum](https://openmc.discourse.group/).
interested in the project, or would like to help and contribute, please get in
touch on the OpenMC [discussion forum](https://openmc.discourse.group/).
## Installation
@ -35,20 +37,21 @@ citing the following publication:
## Troubleshooting
If you run into problems compiling, installing, or running OpenMC, first check
the [Troubleshooting section](https://docs.openmc.org/en/stable/usersguide/troubleshoot.html) in
the User's Guide. If you are not able to find a solution to your problem there,
the [Troubleshooting
section](https://docs.openmc.org/en/stable/usersguide/troubleshoot.html) in the
User's Guide. If you are not able to find a solution to your problem there,
please post to the [discussion forum](https://openmc.discourse.group/).
## Reporting Bugs
OpenMC is hosted on GitHub and all bugs are reported and tracked through the
[Issues](https://github.com/openmc-dev/openmc/issues) feature on GitHub. However,
GitHub Issues should not be used for common troubleshooting purposes. If you are
having trouble installing the code or getting your model to run properly, you
should first send a message to the User's Group mailing list. If it turns out
your issue really is a bug in the code, an issue will then be created on
GitHub. If you want to request that a feature be added to the code, you may
create an Issue on github.
[Issues](https://github.com/openmc-dev/openmc/issues) feature on GitHub.
However, GitHub Issues should not be used for common troubleshooting purposes.
If you are having trouble installing the code or getting your model to run
properly, you should first send a message to the [discussion
forum](https://openmc.discourse.group/). If it turns out your issue really is a
bug in the code, an issue will then be created on GitHub. If you want to request
that a feature be added to the code, you may create an Issue on github.
## License

View file

@ -14,8 +14,8 @@ if(DEFINED ENV{METHOD})
message(STATUS "Using environment variable METHOD to determine libMesh build: ${LIBMESH_PC_FILE}")
endif()
include(FindPkgConfig)
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${LIBMESH_PC}")
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH True)
pkg_check_modules(LIBMESH REQUIRED ${LIBMESH_PC_FILE}>=1.6.0 IMPORTED_TARGET)
pkg_get_variable(LIBMESH_PREFIX ${LIBMESH_PC_FILE} prefix)
find_package(PkgConfig REQUIRED)
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
pkg_check_modules(LIBMESH REQUIRED ${LIBMESH_PC_FILE}>=1.7.0 IMPORTED_TARGET)
pkg_get_variable(LIBMESH_PREFIX ${LIBMESH_PC_FILE} prefix)

View file

@ -0,0 +1,120 @@
# GetVersionFromGit.cmake
# Standalone script to retrieve versioning information from Git or .git_archival.txt.
# Customizable for any project by setting variables before including this file.
# Configurable variables:
# - VERSION_PREFIX: Prefix for version tags (default: "v").
# - VERSION_SUFFIX: Suffix for version tags (default: "[~+-]([a-zA-Z0-9]+)").
# - VERSION_REGEX: Regex to extract version (default: "(?[0-9]+\\.[0-9]+\\.[0-9]+)").
# - ARCHIVAL_FILE: Path to .git_archival.txt (default: "${CMAKE_SOURCE_DIR}/.git_archival.txt").
# - DESCRIBE_NAME_KEY: Key for describe name in .git_archival.txt (default: "describe-name: ").
# - COMMIT_HASH_KEY: Key for commit hash in .git_archival.txt (default: "commit: ").
# Default Format Example:
# 1.2.3 v1.2.3 v1.2.3-rc1
set(VERSION_PREFIX "v" CACHE STRING "Prefix used in version tags")
set(VERSION_SUFFIX "[~+-]([a-zA-Z0-9]+)" CACHE STRING "Suffix used in version tags")
set(VERSION_REGEX "?([0-9]+\\.[0-9]+\\.[0-9]+)" CACHE STRING "Regex for extracting version")
set(ARCHIVAL_FILE "${CMAKE_SOURCE_DIR}/.git_archival.txt" CACHE STRING "Path to .git_archival.txt")
set(DESCRIBE_NAME_KEY "describe-name: " CACHE STRING "Key for describe name in .git_archival.txt")
set(COMMIT_HASH_KEY "commit: " CACHE STRING "Key for commit hash in .git_archival.txt")
# Combine prefix and regex
set(VERSION_REGEX_WITH_PREFIX "^${VERSION_PREFIX}${VERSION_REGEX}")
# Find Git
find_package(Git)
# Attempt to retrieve version from Git
if(EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT_FOUND)
message(STATUS "Using git describe for versioning")
# Extract the version string
execute_process(
COMMAND git describe --tags --dirty
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE VERSION_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
# If no tags are found, set version to 0 and show a warning
if(VERSION_STRING STREQUAL "")
set(VERSION_STRING "0.0.0")
message(WARNING
"No git tags found. Version set to 0.0.0.\n"
"Run 'git fetch --tags' to ensure proper versioning.\n"
"For more information, see OpenMC developer documentation."
)
endif()
# Extract the commit hash
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
message(STATUS "Using archival file for versioning: ${ARCHIVAL_FILE}")
if(EXISTS "${ARCHIVAL_FILE}")
file(READ "${ARCHIVAL_FILE}" ARCHIVAL_CONTENT)
# Extract the describe-name line
string(REGEX MATCH "${DESCRIBE_NAME_KEY}([^\\n]+)" VERSION_STRING "${ARCHIVAL_CONTENT}")
if(VERSION_STRING MATCHES "${DESCRIBE_NAME_KEY}(.*)")
set(VERSION_STRING "${CMAKE_MATCH_1}")
else()
message(FATAL_ERROR "Could not extract version from ${ARCHIVAL_FILE}")
endif()
# Extract the commit hash
string(REGEX MATCH "${COMMIT_HASH_KEY}([a-f0-9]+)" COMMIT_HASH "${ARCHIVAL_CONTENT}")
if(COMMIT_HASH MATCHES "${COMMIT_HASH_KEY}([a-f0-9]+)")
set(COMMIT_HASH "${CMAKE_MATCH_1}")
else()
message(FATAL_ERROR "Could not extract commit hash from ${ARCHIVAL_FILE}")
endif()
else()
message(FATAL_ERROR "Neither git describe nor ${ARCHIVAL_FILE} is available for versioning.")
endif()
endif()
# Ensure version string format
if(VERSION_STRING MATCHES "${VERSION_REGEX_WITH_PREFIX}")
set(VERSION_NO_SUFFIX "${CMAKE_MATCH_1}")
else()
message(FATAL_ERROR "Invalid version format: Missing base version in ${VERSION_STRING}")
endif()
# Check for development state
if(VERSION_STRING MATCHES "-([0-9]+)-g([0-9a-f]+)")
set(DEV_STATE "true")
set(COMMIT_COUNT "${CMAKE_MATCH_1}")
string(REGEX REPLACE "-([0-9]+)-g([0-9a-f]+)" "" VERSION_WITHOUT_META "${VERSION_STRING}")
else()
set(DEV_STATE "false")
set(VERSION_WITHOUT_META "${VERSION_STRING}")
endif()
# Split and set version components
string(REPLACE "." ";" VERSION_LIST "${VERSION_NO_SUFFIX}")
list(GET VERSION_LIST 0 VERSION_MAJOR)
list(GET VERSION_LIST 1 VERSION_MINOR)
list(GET VERSION_LIST 2 VERSION_PATCH)
# Increment patch number for dev versions
if(DEV_STATE)
math(EXPR VERSION_PATCH "${VERSION_PATCH} + 1")
endif()
# Export variables
set(OPENMC_VERSION_MAJOR "${VERSION_MAJOR}")
set(OPENMC_VERSION_MINOR "${VERSION_MINOR}")
set(OPENMC_VERSION_PATCH "${VERSION_PATCH}")
set(OPENMC_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
set(OPENMC_COMMIT_HASH "${COMMIT_HASH}")
set(OPENMC_DEV_STATE "${DEV_STATE}")
set(OPENMC_COMMIT_COUNT "${COMMIT_COUNT}")

View file

@ -1,19 +1,21 @@
get_filename_component(OpenMC_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
find_package(fmt REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../fmt)
find_package(gsl-lite REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../gsl-lite)
find_package(pugixml REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../pugixml)
find_package(xtl REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../xtl)
find_package(xtensor REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../xtensor)
if(@dagmc@)
# Compute the install prefix from this file's location
get_filename_component(_OPENMC_PREFIX "${OpenMC_CMAKE_DIR}/../../.." ABSOLUTE)
find_package(fmt CONFIG REQUIRED HINTS ${_OPENMC_PREFIX})
find_package(pugixml CONFIG REQUIRED HINTS ${_OPENMC_PREFIX})
find_package(xtl CONFIG REQUIRED HINTS ${_OPENMC_PREFIX})
find_package(xtensor CONFIG REQUIRED HINTS ${_OPENMC_PREFIX})
if(@OPENMC_USE_DAGMC@)
find_package(DAGMC REQUIRED HINTS @DAGMC_DIR@)
endif()
if(@libmesh@)
if(@OPENMC_USE_LIBMESH@)
include(FindPkgConfig)
list(APPEND CMAKE_PREFIX_PATH @LIBMESH_PREFIX@)
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH True)
pkg_check_modules(LIBMESH REQUIRED @LIBMESH_PC_FILE@>=1.6.0 IMPORTED_TARGET)
pkg_check_modules(LIBMESH REQUIRED @LIBMESH_PC_FILE@>=1.7.0 IMPORTED_TARGET)
endif()
find_package(PNG)
@ -21,3 +23,15 @@ find_package(PNG)
if(NOT TARGET OpenMC::libopenmc)
include("${OpenMC_CMAKE_DIR}/OpenMCTargets.cmake")
endif()
if(@OPENMC_USE_MPI@)
find_package(MPI REQUIRED)
endif()
if(@OPENMC_USE_OPENMP@)
find_package(OpenMP REQUIRED)
endif()
if(@OPENMC_USE_UWUW@ AND NOT ${DAGMC_BUILD_UWUW})
message(FATAL_ERROR "UWUW is enabled in OpenMC but the DAGMC installation discovered was not configured with UWUW.")
endif()

View file

@ -1,11 +0,0 @@
sphinx==4.3.0
sphinx-numfig
jupyter
sphinxcontrib-katex
sphinxcontrib-svg2pdfconverter
numpy
scipy
h5py
pandas
uncertainties
matplotlib

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View file

@ -84,6 +84,17 @@ Functions
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_cell_get_density(int32_t index, const int32_t* instance, double* density)
Get the density of a cell
:param int32_t index: Index in the cells array
:param int32_t* instance: Which instance of the cell. If a null pointer is passed, the density
multiplier of the first instance is returned.
:param double* density: Density of the cell in [g/cm3]
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_cell_set_fill(int32_t index, int type, int32_t n, const int32_t* indices)
Set the fill for a cell
@ -113,8 +124,22 @@ Functions
:param double T: Temperature in Kelvin
:param instance: Which instance of the cell. To set the temperature for all
instances, pass a null pointer.
:param set_contained: If the cell is not filled by a material, whether to set the temperatures
of all filled cells
:param bool set_contained: If the cell is not filled by a material, whether
to set the temperatures of all filled cells
:type instance: const int32_t*
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_cell_set_density(index index, double density, const int32_t* instance, bool set_contained)
Set the density of a cell.
:param int32_t index: Index in the cells array
:param double density: Density of the cell in [g/cm3]
:param instance: Which instance of the cell. To set the density multiplier for all
instances, pass a null pointer.
:param bool set_contained: If the cell is not filled by a material, whether
to set the density multiplier of all filled cells
:type instance: const int32_t*
:return: Return status (negative if an error occurred)
:rtype: int
@ -355,7 +380,7 @@ Functions
Get density of a material.
:param int32_t index: Index in the materials array
:param double* denity: Pointer to a density
:param double* density: Pointer to a density
:return: Return status (negative if an error occurs)
:rtype: int
@ -420,6 +445,16 @@ Functions
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_mesh_filter_get_mesh(int32_t index, int32_t* index_mesh)
Get the mesh for a mesh filter
:param int32_t index: Index in the filters array
:param index_mesh: Index in the meshes array
:type index_mesh: int32_t*
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_mesh_filter_set_mesh(int32_t index, int32_t index_mesh)
Set the mesh for a mesh filter
@ -429,6 +464,98 @@ Functions
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_mesh_filter_get_translation(int32_t index, double translation[3])
Get the 3-D translation coordinates for a mesh filter
:param int32_t index: Index in the filters array
:param double[3] translation: 3-D translation coordinates
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_mesh_filter_set_translation(int32_t index, double translation[3])
Set the 3-D translation coordinates for a mesh filter
:param int32_t index: Index in the filters array
:param double[3] translation: 3-D translation coordinates
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_meshborn_filter_get_mesh(int32_t index, int32_t* index_mesh)
Get the mesh for a meshborn filter
:param int32_t index: Index in the filters array
:param index_mesh: Index in the meshes array
:type index_mesh: int32_t*
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_meshborn_filter_set_mesh(int32_t index, int32_t index_mesh)
Set the mesh for a meshborn filter
:param int32_t index: Index in the filters array
:param int32_t index_mesh: Index in the meshes array
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_meshborn_filter_get_translation(int32_t index, double translation[3])
Get the 3-D translation coordinates for a meshborn filter
:param int32_t index: Index in the filters array
:param double[3] translation: 3-D translation coordinates
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_meshborn_filter_set_translation(int32_t index, double translation[3])
Set the 3-D translation coordinates for a meshborn filter
:param int32_t index: Index in the filters array
:param double[3] translation: 3-D translation coordinates
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_meshsurface_filter_get_mesh(int32_t index, int32_t* index_mesh)
Get the mesh for a mesh surface filter
:param int32_t index: Index in the filters array
:param index_mesh: Index in the meshes array
:type index_mesh: int32_t*
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_meshsurface_filter_set_mesh(int32_t index, int32_t index_mesh)
Set the mesh for a mesh surface filter
:param int32_t index: Index in the filters array
:param int32_t index_mesh: Index in the meshes array
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_meshsurface_filter_get_translation(int32_t index, double translation[3])
Get the 3-D translation coordinates for a mesh surface filter
:param int32_t index: Index in the filters array
:param double[3] translation: 3-D translation coordinates
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_meshsurface_filter_set_translation(int32_t index, double translation[3])
Set the 3-D translation coordinates for a mesh surface filter
:param int32_t index: Index in the filters array
:param double[3] translation: 3-D translation coordinates
:return: Return status (negative if an error occurred)
:rtype: int
.. c:function:: int openmc_next_batch()
Simulate next batch of particles. Must be called after openmc_simulation_init().
@ -460,6 +587,13 @@ Functions
:return: Return status (negative if an error occurs)
:rtype: int
.. c:function:: int openmc_remove_tally(int32_t index);
Given an index of a tally, remove it from the tallies array
:param int index: Index in tallies array
:return: Return status (negative if an error occurs)
:rtype: int
.. c:function:: int openmc_run()
Run a simulation

View file

@ -52,7 +52,7 @@ if not on_rtd:
templates_path = ['_templates']
# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = {'.rst': 'restructuredtext'}
# The encoding of source files.
#source_encoding = 'utf-8'
@ -62,16 +62,17 @@ master_doc = 'index'
# General information about the project.
project = 'OpenMC'
copyright = '2011-2022, Massachusetts Institute of Technology, UChicago Argonne LLC, and OpenMC contributors'
copyright = '2011-2025, Massachusetts Institute of Technology, UChicago Argonne LLC, 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.13"
import openmc
# The full version, including alpha/beta/rc tags.
release = "0.13.0"
version = release = openmc.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -120,10 +121,8 @@ pygments_style = 'tango'
# -- Options for HTML output ---------------------------------------------------
# The theme to use for HTML and HTML Help pages
if not on_rtd:
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_theme = 'sphinx_rtd_theme'
html_baseurl = "https://docs.openmc.org/en/stable/"
html_logo = '_images/openmc_logo.png'
@ -215,6 +214,7 @@ latex_elements = {
\setcounter{tocdepth}{2}
\numberwithin{equation}{section}
\DeclareUnicodeCharacter{03B1}{$\alpha$}
\DeclareUnicodeCharacter{03C0}{$\pi$}
""",
'printindex': r""
}
@ -246,7 +246,7 @@ napoleon_use_ivar = True
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
'numpy': ('https://numpy.org/doc/stable/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference', None),
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
'matplotlib': ('https://matplotlib.org/', None)
'matplotlib': ('https://matplotlib.org/stable/', None)
}

View file

@ -109,7 +109,7 @@ Leadership Team
The TC consists of the following individuals:
- `Paul Romano <https://github.com/paulromano>`_
- `Sterling Harper <https://github.com/smharper>`_
- `Patrick Shriwise <https://github.com/pshriwise>`_
- `Adam Nelson <https://github.com/nelsonag>`_
- `Benoit Forget <https://github.com/bforget>`_

View file

@ -5,21 +5,14 @@ Building Sphinx Documentation
=============================
In order to build the documentation in the ``docs`` directory, you will need to
have the `Sphinx <https://www.sphinx-doc.org/en/master/>`_ third-party Python
package. The easiest way to install Sphinx is via pip:
have the several third-party Python packages installed, including `Sphinx
<https://www.sphinx-doc.org/en/master/>`_. To install the necessary
prerequisites, provide the optional "docs" dependencies when installing OpenMC's
Python API. That is, from the root directory of the OpenMC repository:
.. code-block:: sh
pip install sphinx
Additionally, you will need several Sphinx extensions that can be installed
directly with pip:
.. code-block:: sh
pip install sphinx-numfig
pip install sphinxcontrib-katex
pip install sphinxcontrib-svg2pdfconverter
python -m pip install ".[docs]"
-----------------------------------
Building Documentation as a Webpage

View file

@ -45,12 +45,11 @@ Now you can run the following to create a `Docker container`_ called
This command will open an interactive shell running from within the
Docker container where you have access to use OpenMC.
.. note:: The ``docker run`` command supports many
`options <https://docs.docker.com/engine/reference/commandline/run/>`_
.. note:: The ``docker run`` command supports many options_
for spawning containers -- including `mounting volumes`_ from the
host filesystem -- which many users will find useful.
.. _Docker image: https://docs.docker.com/engine/reference/commandline/images/
.. _Docker image: https://docs.docker.com/get-started/docker-concepts/the-basics/what-is-an-image/
.. _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/
.. _options: https://docs.docker.com/reference/cli/docker/container/run/
.. _mounting volumes: https://docs.docker.com/engine/storage/volumes/

View file

@ -15,6 +15,7 @@ other related topics.
contributing
workflow
styleguide
policies
tests
user-input
docbuild

View file

@ -0,0 +1,35 @@
.. _devguide_policies:
========
Policies
========
---------------------
Python Version Policy
---------------------
OpenMC follows the Scientific Python Ecosystem Coordination guidelines `SPEC 0
<https://scientific-python.org/specs/spec-0000/>`_ on minimum supported
versions, which recommends that support for Python versions be dropped 3 years
after their initial release.
-------------------
C++ Standard Policy
-------------------
C++ code in OpenMC must conform to the most recent C++ standard that is fully
supported in the `version of the gcc compiler
<https://gcc.gnu.org/projects/cxx-status.html>`_ that is distributed with the
oldest version of Ubuntu that is still within its `standard support period
<https://ubuntu.com/about/release-cycle>`_. Ubuntu 20.04 LTS will be supported
through April 2025 and is distributed with gcc 9.3.0, which fully supports the
C++17 standard.
--------------------
CMake Version Policy
--------------------
Similar to the C++ standard policy, the minimum supported version of CMake
corresponds to whatever version is distributed with the oldest version of Ubuntu
still within its standard support period. Ubuntu 20.04 LTS is distributed with
CMake 3.16.

View file

@ -29,6 +29,10 @@ whenever a file is saved. For example, `Visual Studio Code
<https://code.visualstudio.com/docs/cpp/cpp-ide#_code-formatting>`_ includes
support for running clang-format.
.. note::
OpenMC's CI uses `clang-format` version 15. A different version of `clang-format`
may produce different line changes and as a result fail the CI test.
Miscellaneous
-------------
@ -36,14 +40,15 @@ Follow the `C++ Core Guidelines`_ except when they conflict with another
guideline listed here. For convenience, many important guidelines from that
list are repeated here.
Conform to the C++14 standard.
Conform to the C++17 standard.
Always use C++-style comments (``//``) as opposed to C-style (``/**/``). (It
is more difficult to comment out a large section of code that uses C-style
comments.)
Do not use C-style casting. Always use the C++-style casts ``static_cast``,
``const_cast``, or ``reinterpret_cast``. (See `ES.49 <http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es49-if-you-must-use-a-cast-use-a-named-cast>`_)
``const_cast``, or ``reinterpret_cast``. (See `ES.49
<https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es49-if-you-must-use-a-cast-use-a-named-cast>`_)
Source Files
------------
@ -51,7 +56,7 @@ Source Files
Use a ``.cpp`` suffix for code files and ``.h`` for header files.
Header files should always use include guards with the following style (See
`SF.8 <http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#sf8-use-include-guards-for-all-h-files>`_):
`SF.8 <https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-guards>`_):
.. code-block:: C++
@ -142,7 +147,7 @@ Style for Python code should follow PEP8_.
Docstrings for functions and methods should follow numpydoc_ style.
Python code should work with Python 3.6+.
Python code should work with Python 3.8+.
Use of third-party Python packages should be limited to numpy_, scipy_,
matplotlib_, pandas_, and h5py_. Use of other third-party packages must be
@ -152,11 +157,11 @@ Prefer pathlib_ when working with filesystem paths over functions in the os_
module or other standard-library modules. Functions that accept arguments that
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/
.. _C++ Core Guidelines: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
.. _PEP8: https://peps.python.org/pep-0008/
.. _numpydoc: https://numpydoc.readthedocs.io/en/latest/format.html
.. _numpy: https://numpy.org/
.. _scipy: https://www.scipy.org/
.. _scipy: https://scipy.org/
.. _matplotlib: https://matplotlib.org/
.. _pandas: https://pandas.pydata.org/
.. _h5py: https://www.h5py.org/

View file

@ -23,17 +23,17 @@ Prerequisites
OpenMC in development/editable mode. With setuptools, this is accomplished by
running::
python setup.py develop
or using pip (recommended)::
pip install -e .[test]
python -m pip install -e .[test]
- The test suite requires a specific set of cross section data in order for
tests to pass. A download URL for the data that OpenMC expects can be found
within ``tools/ci/download-xs.sh``.
within ``tools/ci/download-xs.sh``. Once the tarball is downloaded and
unpacked, set the :envvar:`OPENMC_CROSS_SECTIONS` environment variable to the
path of the ``cross_sections.xml`` file within the unpacked data.
- In addition to the HDF5 data, some tests rely on ENDF files. A download URL
for those can also be found in ``tools/ci/download-xs.sh``.
for those can also be found in ``tools/ci/download-xs.sh``. Once the tarball
is downloaded and unpacked, set the :envvar:`OPENMC_ENDF_DATA` environment
variable to the top-level directory of the unpacked tarball.
- Some tests require `NJOY <https://www.njoy21.io/NJOY2016>`_ to preprocess
cross section data. The test suite assumes that you have an ``njoy``
executable available on your :envvar:`PATH`.
@ -41,7 +41,7 @@ Prerequisites
Running Tests
-------------
To execute the test suite, go to the ``tests/`` directory and run::
To execute the Python test suite, go to the ``tests/`` directory and run::
pytest
@ -51,6 +51,63 @@ installed and run::
pytest --cov=../openmc --cov-report=html
To execute the C++ test suite, go to your build directory and run::
ctest
If you want to view testing output on failure run::
ctest --output-on-failure
Possible Reasons for Test Failures
----------------------------------
You may find that when you run the test suite, not everything passes. First,
make sure you have satisfied all the prerequisites above. After you have done
that, consider the following:
- When building OpenMC, make sure you run CMake with
``-DCMAKE_BUILD_TYPE=Debug``. Building with a release build will result in
some test failures due to differences in which compiler optimizations are
used.
- Because tallies involve the sum of many floating point numbers, the
non-associativity of floating point numbers can result in different answers
especially when the number of threads is high (different order of operations).
Thus, if you are running on a CPU with many cores, you may need to limit the
number of OpenMP threads used. It is recommended to set the
:envvar:`OMP_NUM_THREADS` environment variable to 2.
- Recent versions of NumPy use instruction dispatch that may generate different
results depending the particular ISA that you are running on. To avoid issues,
you may need to disable AVX512 instructions. This can be done by setting the
:envvar:`NPY_DISABLE_CPU_FEATURES` environment variable to "AVX512F
AVX512_SKX". When NumPy/SciPy are built against OpenBLAS, you may also need to
limit the number of threads that OpenBLAS uses internally; this can be done by
setting the :envvar:`OPENBLAS_NUM_THREADS` environment variable to 1.
Debugging Tests in CI
---------------------
Tests can be debugged in CI using a feature called
`tmate <https://github.com/mxschmitt/action-tmate?tab=readme-ov-file#debug-your-github-actions-by-using-tmate>`_.
CI debugging can be
enabled by including "[gha-debug]" in the commit message. When the test fails, a
link similar to the one shown below will be provided in the GitHub Actions
output after failure occurs. Logging into the provided link will allow you to
debug the test in the CI environment. The following is an example of the output
shown in the CI log that provides the link to the tmate session:
.. code-block:: text
:linenos:
Created new session successfully
ssh 2VcykjU7vNdvAzEjQcc839GM2@nyc1.tmate.io
https://tmate.io/t/2VcykjU7vNdvAzEjQcc839GM2
Entering main loop
Web shell: https://tmate.io/t/2VcykjU7vNdvAzEjQcc839GM2
SSH: ssh 2VcykjU7vNdvAzEjQcc839GM2@nyc1.tmate.io
...
Generating XML Inputs
---------------------
@ -62,6 +119,23 @@ run::
pytest --build-inputs <name-of-test>
Adding C++ Unit Tests
---------------------
The C++ test suite uses Catch2 integrated with CTest. Each header file should
have a corresponding test file in ``tests/cpp_unit_tests/``. If the test file
does not exist run::
touch test_<name-of-header-file>.cpp
The file must be added to the CMake build system in
``tests/cpp_unit_tests/CMakeLists.txt``. ``test_<name-of-header-file>`` should
be added to ``TEST_NAMES``.
To add a test case to ``test_<name-of-header-file>.cpp`` ensure
``catch2/catch_test_macros.hpp`` is included. A unit test can then be added
using the ``TEST_CASE`` macro and the ``REQUIRE`` assertion from Catch2.
Adding Tests to the Regression Suite
------------------------------------
@ -84,6 +158,12 @@ following files to your new test directory:
compiler options during openmc configuration and build (e.g., no MPI, no
debug/optimization).
For tests using the Python API, both the **inputs_true.dat** and
**results_true.dat** files can be generated automatically in the correct format
via::
pytest --update <name-of-test>
In addition to this description, please see the various types of tests that are
already included in the test suite to see how to create them. If all is
implemented correctly, the new test will automatically be discovered by pytest.

View file

@ -49,23 +49,12 @@ following steps should be followed to make changes to user input:
written out to the statepoint or summary files and that the
:class:`openmc.StatePoint` and :class:`openmc.Summary` classes read them in.
7. Finally, a set of `RELAX NG`_ schemas exists that enables validation of input
files. You should modify the RELAX NG schema for the file you changed. The
easiest way to do this is to change the `compact syntax`_ file
(e.g. ``src/relaxng/geometry.rnc``) and then convert it to regular XML syntax
using trang_::
trang geometry.rnc geometry.rng
For most user input additions and changes, it is simple enough to follow a
"monkey see, monkey do" approach. When in doubt, contact your nearest OpenMC
developer or send a message to the `developers mailing list`_.
.. _property attribute: https://docs.python.org/3.6/library/functions.html#property
.. _XML Schema Part 2: http://www.w3.org/TR/xmlschema-2/
.. _boolean: http://www.w3.org/TR/xmlschema-2/#boolean
.. _RELAX NG: https://relaxng.org/
.. _compact syntax: https://relaxng.org/compact-tutorial-20030326.html
.. _trang: https://relaxng.org/jclark/trang.html
.. _XML Schema Part 2: https://www.w3.org/TR/xmlschema-2/
.. _boolean: https://www.w3.org/TR/xmlschema-2/#boolean
.. _developers mailing list: https://groups.google.com/forum/?fromgroups=#!forum/openmc-dev

View file

@ -4,7 +4,7 @@
Development Workflow
====================
Anyone wishing to make contributions to OpenMC should be fully acquianted and
Anyone wishing to make contributions to OpenMC should be fully acquainted and
comfortable working with git_ and GitHub_. We assume here that you have git
installed on your system, have a GitHub account, and have setup SSH keys to be
able to create/push to repositories on GitHub.
@ -81,7 +81,7 @@ features and bug fixes. The general steps for contributing are as follows:
openmc-dev/openmc as the target.
At a minimum, you should describe what the changes you've made are and why
you are making them. If the changes are related to an oustanding issue, make
you are making them. If the changes are related to an outstanding issue, make
sure it is cross-referenced.
5. A committer will review your pull request based on the criteria
@ -91,6 +91,30 @@ features and bug fixes. The general steps for contributing are as follows:
6. After the pull request has been thoroughly vetted, it is merged back into the
*develop* branch of openmc-dev/openmc.
Setting Up Upstream Tracking (Required for Versioning)
------------------------------------------------------
By default, your fork **does not** include tags from the upstream OpenMC repository.
OpenMC relies on `git describe --tags` for versioning in source builds, and missing tags can lead
to incorrect version detection (i.e., ``0.0.0``). To ensure proper versioning, follow these steps:
1. **Add the Upstream Repository**
This allows you to fetch updates from the main OpenMC repository.
.. code-block:: sh
git remote add upstream https://github.com/openmc-dev/openmc.git
2. **Fetch and Push Tags**
Retrieve tags from the upstream repository and update your fork:
.. code-block:: sh
git fetch --tags upstream
git push --tags origin
This ensures that both your **local** and **remote** fork have the correct versioning information.
Private Development
-------------------
@ -116,20 +140,20 @@ pip_. From the root directory of the OpenMC repository, run:
.. code-block:: sh
pip install -e .[test]
python -m pip install -e .[test]
This installs the OpenMC Python package in `"editable" mode
<https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>`_ so
that 1) it can be imported from a Python interpreter and 2) any changes made are
<https://pip.pypa.io/en/stable/cli/pip_install/#editable-installs>`_ so that 1)
it can be imported from a Python interpreter and 2) any changes made are
immediately reflected in the installed version (that is, you don't need to keep
reinstalling it). While the same effect can be achieved using the
:envvar:`PYTHONPATH` environment variable, this is generally discouraged as it
can interfere with virtual environments.
.. _git: http://git-scm.com/
.. _git: https://git-scm.com/
.. _GitHub: https://github.com/
.. _git flow: https://nvie.com/git-model
.. _valgrind: https://www.valgrind.org/
.. _valgrind: https://valgrind.org/
.. _style guide: https://docs.openmc.org/en/latest/devguide/styleguide.html
.. _pull request: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests
.. _openmc-dev/openmc: https://github.com/openmc-dev/openmc

View file

@ -12,7 +12,7 @@ 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
Group <https://crpg.mit.edu>`_ at the `Massachusetts Institute of Technology
<https://web.mit.edu>`_ starting in 2011. Various universities, laboratories,
and other organizations now contribute to the development of OpenMC. For more
information on OpenMC, feel free to post a message on the `OpenMC Discourse

View file

@ -56,6 +56,27 @@ attributes:
.. _io_chain_reaction:
--------------------
``<source>`` Element
--------------------
The ``<source>`` element represents photon and electron sources associated with
the decay of a nuclide and contains information to construct an
:class:`openmc.stats.Univariate` object that represents this emission as an
energy distribution. This element has the following attributes:
:type:
The type of :class:`openmc.stats.Univariate` source term.
:particle:
The type of particle emitted, e.g., 'photon' or 'electron'
:parameters:
The parameters of the source term, e.g., for a
:class:`openmc.stats.Discrete` source, the energies (in [eV]) at which the
particles are emitted and their relative intensities in [Bq/atom] (in other
words, decay constants).
----------------------
``<reaction>`` Element
----------------------

View file

@ -47,10 +47,3 @@ The current version of the depletion results file format is 1.1.
**/reactions/<name>/**
:Attributes: - **index** (*int*) -- Index user in results for this reaction
.. note::
The reaction rates for some isotopes not originally present may
be non-zero, but should be negligible compared to other atoms.
This can be controlled by changing the
:class:`openmc.deplete.Operator` ``dilute_initial`` attribute.

View file

@ -48,7 +48,7 @@ Each ``<surface>`` element can have the following attributes or sub-elements:
:periodic_surface_id:
If a periodic boundary condition is applied, this attribute identifies the
``id`` of the corresponding periodic sufrace.
``id`` of the corresponding periodic surface.
The following quadratic surfaces can be modeled:
@ -219,6 +219,30 @@ Each ``<cell>`` element can have the following attributes or sub-elements:
*Default*: None
:triso_particle:
If the cell is filled with a TRISO particle, use this element to mark it.
.. note:: Only cells with spherical area can be marked.
*Default*: false
:virtual_lattice:
If the cell is filled with a matrix containing the TRISO particle, use this
element to mark it. This can accelerate the search speed of neutrons in the
region containing a large number of TRISO particles.
*Default*: false
:shape:
If the virtual_lattice is True. This element specifies the shape of the
lattice.
.. note:: The shape of the lattice must be specified if the virtual_lattice
is True. Related methods can be referred to Liang, J., Li, R., Liu, Z.,
2024. Virtual lattice method for efficient Monte Carlo transport simulation
of dispersion nuclear fuels. Computer Physics Communications 295, 108985.
https://doi.org/10.1016/j.cpc.2023.108985
---------------------
``<lattice>`` Element
@ -407,13 +431,33 @@ Each ``<dagmc_universe>`` element can have the following attributes or sub-eleme
*Default*: None
:material_overrides:
This element contains information on material overrides to be applied to the
DAGMC universe. It has the following attributes and sub-elements:
.. note:: A geometry.xml file containing only a DAGMC model for a file named `dagmc.h5m` (no CSG)
looks as follows
:cell:
Material override information for a single cell. It contains the following
attributes and sub-elements:
.. code-block:: xml
:id:
The cell ID in the DAGMC geometry for which the material override will
apply.
<?xml version='1.0' encoding='utf-8'?>
<geometry>
<dagmc_universe filename="dagmc.h5m" id="1" />
</geometry>
:materials:
A list of material IDs that will apply to instances of the cell. If the
list contains only one ID, it will replace the original material
assignment of all instances of the DAGMC cell. If the list contains more
than one material, each material ID of the list will be assigned to the
various instances of the DAGMC cell.
*Default*: None
.. note:: A geometry.xml file containing only a DAGMC model for a file named
`dagmc.h5m` (no CSG) looks as follows:
.. code-block:: xml
<?xml version='1.0' encoding='utf-8'?>
<geometry>
<dagmc_universe filename="dagmc.h5m" id="1" />
</geometry>

View file

@ -51,3 +51,4 @@ Output Files
track
voxel
volume
weight_windows

View file

@ -339,6 +339,16 @@ Incoherent elastic scattering
[eV\ :math:`^{-1}`].
:Attributes: - **type** (*char[]*) -- 'IncoherentElastic'
Sum of functions
----------------
:Object type: Group
:Attributes: - **type** (*char[]*) -- "Sum"
- **n** (*int*) -- Number of functions
:Datasets:
- ***func_<i>** (:ref:`function <1d_functions>`) -- Dataset for the
i-th function (indexing starts at 1)
.. _angle_energy:
--------------------------
@ -501,6 +511,19 @@ equiprobable bins.
- **skewed** (*int8_t*) -- Whether discrete angles are equi-probable
(0) or have a skewed distribution (1).
Mixed Elastic
-------------
This angle-energy distribution is used when an evaluation specifies both
coherent and incoherent elastic thermal neutron scattering.
:Object type: Group
:Attributes: - **type** (*char[]*) -- "mixed_elastic"
:Groups: - **coherent** -- Distribution for coherent elastic scattering. The
format is given in :ref:`angle_energy`.
- **incoherent** -- Distribution for incoherent elastic scattering.
The format is given in :ref:`angle_energy`.
.. _energy_distribution:
--------------------

View file

@ -26,6 +26,8 @@ The current version of the particle restart file format is 2.0.
- **run_mode** (*char[]*) -- Run mode used, either 'fixed source',
'eigenvalue', or 'particle restart'.
- **id** (*int8_t*) -- Unique identifier of the particle.
- **type** (*int*) -- Particle type (0=neutron, 1=photon, 2=electron,
3=positron)
- **weight** (*double*) -- Weight of the particle.
- **energy** (*double*) -- Energy of the particle in eV for
continuous-energy mode, or the energy group of the particle for

View file

@ -7,13 +7,18 @@ Geometry Plotting Specification -- plots.xml
Basic plotting capabilities are available in OpenMC by creating a plots.xml file
and subsequently running with the ``--plot`` command-line flag. The root element
of the plots.xml is simply ``<plots>`` and any number output plots can be
defined with ``<plot>`` sub-elements. Two plot types are currently implemented
defined with ``<plot>`` sub-elements. Four plot types are currently implemented
in openMC:
* ``slice`` 2D pixel plot along one of the major axes. Produces a PNG image
file.
* ``voxel`` 3D voxel data dump. Produces an HDF5 file containing voxel xyz
position and cell or material id.
* ``wireframe_raytrace`` 2D pixel plot of a three-dimensional view of a
geometry using wireframes around cells or materials and coloring by depth
through each material.
* ``solid_raytrace`` 2D pixel plot of a three-dimensional view of a geometry
with solid colored surfaces of a set of cells or materials.
------------------
@ -66,21 +71,22 @@ sub-elements:
*Default*: None - Required entry
:type:
Keyword for type of plot to be produced. Currently only "slice" and "voxel"
plots are implemented. The "slice" plot type creates 2D pixel maps saved in
the PNG file format. The "voxel" plot type produces a binary datafile
containing voxel grid positioning and the cell or material (specified by the
``color`` tag) at the center of each voxel. Voxel plot files can be
processed into VTK files using the :ref:`scripts_voxel` script provided with
OpenMC and subsequently viewed with a 3D viewer such as VISIT or Paraview.
See the :ref:`io_voxel` for information about the datafile structure.
Keyword for type of plot to be produced. Currently "slice", "voxel",
"wireframe_raytrace", and "solid_raytrace" plots are implemented. The
"slice" plot type creates 2D pixel maps saved in the PNG file format. The
"voxel" plot type produces a binary datafile containing voxel grid
positioning and the cell or material (specified by the ``color`` tag) at the
center of each voxel. Voxel plot files can be processed into VTK files using
the :func:`openmc.voxel_to_vtk` function and subsequently viewed with a 3D
viewer such as VISIT or Paraview. See :ref:`io_voxel` for information about
the datafile structure.
.. note:: High-resolution voxel files produced by OpenMC can be quite large,
but the equivalent VTK files will be significantly smaller.
*Default*: "slice"
``<plot>`` elements of ``type`` "slice" and "voxel" must contain the ``pixels``
All ``<plot>`` elements must contain the ``pixels``
attribute or sub-element:
:pixels:
@ -96,7 +102,7 @@ attribute or sub-element:
``width``/``pixels`` along that basis direction may not appear
in the plot.
*Default*: None - Required entry for "slice" and "voxel" plots
*Default*: None - Required entry for all plots
``<plot>`` elements of ``type`` "slice" can also contain the following
attributes or sub-elements. These are not used in "voxel" plots:
@ -125,6 +131,11 @@ attributes or sub-elements. These are not used in "voxel" plots:
Specifies the custom color for the cell or material. Should be 3 integers
separated by spaces.
:xs:
The attenuation coefficient for volume rendering of color in units of
inverse centimeters. Zero corresponds to transparency. Only for plot type
"wireframe_raytrace".
As an example, if your plot is colored by material and you want material 23
to be blue, the corresponding ``color`` element would look like:
@ -151,6 +162,18 @@ attributes or sub-elements. These are not used in "voxel" plots:
*Default*: 255 255 255 (white)
:show_overlaps:
Indicates whether overlapping regions of different cells are shown.
*Default*: None
:overlap_color:
Specifies the RGB color of overlapping regions of different cells. Does not
do anything if ``show_overlaps`` is "false" or not specified. Should be 3
integers separated by spaces.
*Default*: 255 0 0 (red)
:meshlines:
The ``meshlines`` sub-element allows for plotting the boundaries of a
regular mesh on top of a plot. Only one ``meshlines`` element is allowed per
@ -179,3 +202,80 @@ attributes or sub-elements. These are not used in "voxel" plots:
*Default*: 0 0 0 (black)
*Default*: None
``<plot>`` elements of ``type`` "wireframe_raytrace" or "solid_raytrace" can contain the
following attributes or sub-elements.
:camera_position:
Location in 3D Cartesian space the camera is at.
*Default*: None - Required for all ``wireframe_raytrace`` or
``solid_raytrace`` plots
:look_at:
Location in 3D Cartesian space the camera is looking at.
*Default*: None - Required for all ``wireframe_raytrace`` or
``solid_raytrace`` plots
:field_of_view:
The horizontal field of view in degrees. Defaults to roughly the same value
as for the human eye.
*Default*: 70
:orthographic_width:
If set to a nonzero value, an orthographic rather than perspective
projection for the camera is employed. An orthographic projection puts out
parallel rays from the camera of a width prescribed here in the horizontal
direction, with the width in the vertical direction decided by the pixel
aspect ratio.
*Default*: 0
``<plot>`` elements of ``type`` "solid_raytrace" can contain the following attributes or
sub-elements.
:opaque_ids:
List of integer IDs of cells or materials to be treated as visible in the
plot. Whether the integers are interpreted as cell or material IDs depends
on ``color_by``.
*Default*: None - Required for all phong plots
:light_position:
Location in 3D Cartesian space of the light.
*Default*: Same location as ``camera_position``
:diffuse_fraction:
Fraction of light originating from non-directional sources. If set to one,
the coloring is not influenced by surface curvature, and no shadows appear.
If set to zero, only regions illuminated by the light are not black.
*Default*: 0.1
``<plot>`` elements of ``type`` "wireframe_raytrace" can contain the following
attributes or sub-elements.
:wireframe_color:
RGB value of the wireframe's color
*Default*: 0, 0, 0 (black)
:wireframe_thickness:
Integer number of pixels that the wireframe takes up. The value is a radius
of the wireframe. Setting to zero removes any wireframing.
*Default*: 0
:wireframe_ids:
Integer IDs of cells or materials of regions to draw wireframes around.
Whether the integers are interpreted as cell or material IDs depends on
``color_by``.
*Default*: None

View file

@ -4,7 +4,7 @@
Properties File Format
======================
The current version of the properties file format is 1.0.
The current version of the properties file format is 1.1.
**/**
@ -25,6 +25,7 @@ The current version of the properties file format is 1.0.
**/geometry/cells/cell <uid>/**
:Datasets: - **temperature** (*double[]*) -- Temperature of the cell in [K].
- **density** (*double[]*) -- Density of the cell in [g/cm3].
**/materials/**

View file

@ -32,6 +32,17 @@ standard deviation.
*Default*: false
-------------------------------------
``<create_delayed_neutrons>`` Element
-------------------------------------
The ``<create_delayed_neutrons>`` element indicates whether delayed neutrons
are created in fission. If this element is set to "true", delayed neutrons
will be created in fission events; otherwise only prompt neutrons will be
created.
*Default*: true
-------------------------------------
``<create_fission_neutrons>`` Element
-------------------------------------
@ -49,13 +60,15 @@ fission.
``<cutoff>`` Element
--------------------
The ``<cutoff>`` element indicates two kinds of cutoffs. The first is the weight
cutoff used below which particles undergo Russian roulette. Surviving particles
are assigned a user-determined weight. Note that weight cutoffs and Russian
rouletting are not turned on by default. The second is the energy cutoff which
is used to kill particles under certain energy. The energy cutoff should not be
used unless you know particles under the energy are of no importance to results
you care. This element has the following attributes/sub-elements:
The ``<cutoff>`` element indicates three kinds of cutoffs. The first is the
weight cutoff used below which particles undergo Russian roulette. Surviving
particles are assigned a user-determined weight. Note that weight cutoffs and
Russian rouletting are not turned on by default. The second is the energy cutoff
which is used to kill particles under certain energy. The energy cutoff should
not be used unless you know particles under the energy are of no importance to
results you care. The third is the time cutoff used to kill particles whose time
exceeds a specific cutoff. Particles will be killed exactly at the specified
time.
:weight:
The weight below which particles undergo Russian roulette.
@ -68,6 +81,13 @@ you care. This element has the following attributes/sub-elements:
*Default*: 1.0
:survival_normalization:
If this element is set to "true", this will enable the use of survival
biasing source normalization, whereby the weight parameters, weight and
weight_avg, are multiplied per history by the start weight of said history.
*Default*: false
:energy_neutron:
The energy under which neutrons will be killed.
@ -88,6 +108,26 @@ you care. This element has the following attributes/sub-elements:
*Default*: 0.0
:time_neutron
The time above which neutrons will be killed.
*Default*: Infinity
:time_photon
The time above which photons will be killed.
*Default*: Infinity
:time_electron
The time above which electrons will be killed.
*Default*: Infinity
:time_positron
The time above which positorns will be killed.
*Default*: Infinity
----------------------------
``<delayed_photon_scaling>``
----------------------------
@ -138,6 +178,16 @@ history-based parallelism.
*Default*: false
--------------------------------
``<free_gas_threshold>`` Element
--------------------------------
The ``<free_gas_threshold>`` element specifies the energy multiplier, expressed
in units of :math:`kT`, that determines when the free gas scattering approach is
used for elastic scattering. Values must be positive.
*Default*: 400.0
-----------------------------------
``<generations_per_batch>`` Element
-----------------------------------
@ -205,7 +255,7 @@ based on the recommended value in LA-UR-14-24530_.
.. note:: This element is not used in the multi-group :ref:`energy_mode`.
.. _LA-UR-14-24530: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-14-24530.pdf
.. _LA-UR-14-24530: https://mcnp.lanl.gov/pdf_files/TechReport_2014_LANL_LA-UR-14-24530_Brown.pdf
---------------------------
``<material_cell_offsets>``
@ -219,19 +269,45 @@ to false.
*Default*: true
----------------------------------------
``<max_particles_in_flight>`` Element
----------------------------------------
--------------------------------
``<max_lost_particles>`` Element
--------------------------------
This element indicates the number of neutrons to run in flight concurrently
This element indicates the maximum number of lost particles.
*Default*: 10
------------------------------------
``<rel_max_lost_particles>`` Element
------------------------------------
This element indicates the maximum number of lost particles, relative to the
total number of particles.
*Default*: 1.0e-6
-------------------------------------
``<max_particles_in_flight>`` Element
-------------------------------------
This element indicates the number of particles 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_particle_events>`` Element
---------------------------------
This element indicates the maximum number of events a particle can undergo.
*Default*: 1000000
-----------------------
``<max_order>`` Element
---------------------------
-----------------------
The ``<max_order>`` element allows the user to set a maximum scattering order
to apply to every nuclide/material in the problem. That is, if the data
@ -243,6 +319,23 @@ then, OpenMC will only use up to the :math:`P_1` data.
.. note:: This element is not used in the continuous-energy
:ref:`energy_mode`.
--------------------------------
``<max_history_splits>`` Element
--------------------------------
The ``<max_history_splits>`` element indicates the number of times a particle can split during a history.
*Default*: 1000
--------------------------------------
``<max_write_lost_particles>`` Element
--------------------------------------
This ``<max_write_lost_particles>`` element indicates the maximum number of
particle restart files (per MPI process) to write for lost particles.
*Default*: None
.. _mesh_element:
------------------
@ -334,6 +427,15 @@ either "false" or "true".
*Default*: false
-----------------------
``<plot_seed>`` Element
-----------------------
The ``<plot_seed>`` element is used to set the seed for the pseudorandom number
generator during generation of colors in plots.
*Default*: 1
---------------------
``<ptables>`` Element
---------------------
@ -346,6 +448,64 @@ or sub-elements and can be set to either "false" or "true".
.. note:: This element is not used in the multi-group :ref:`energy_mode`.
------------------------
``<random_ray>`` Element
------------------------
The ``<random_ray>`` element enables random ray mode and contains a number of
settings relevant to the solver. Tips for selecting these parameters can be
found in the :ref:`random ray user guide <random_ray>`.
:distance_inactive:
The inactive ray length (dead zone length) in [cm].
*Default*: None
:distance_active:
The active ray length in [cm].
*Default*: None
:source:
Specifies the starting ray distribution, and follows the format for
:ref:`source_element`. It must be uniform in space and angle and cover the
full domain. It does not represent a physical neutron or photon source -- it
is only used to sample integrating ray starting locations and directions.
*Default*: None
:sample_method:
Specifies the method for sampling the starting ray distribution. This
element can be set to "prng" or "halton".
*Default*: prng
:source_region_meshes:
Relates meshes to spatial domains for subdividing source regions with each domain.
:mesh:
Contains an ``id`` attribute and one or more ``<domain>`` sub-elements.
:id:
The unique identifier for the mesh.
:domain:
Each domain element has an ``id`` attribute and a ``type`` attribute.
:id:
The unique identifier for the domain.
:type:
The type of the domain. Can be ``material``, ``cell``, or ``universe``.
:diagonal_stabilization_rho:
The rho factor for use with diagonal stabilization. This technique is
applied when negative diagonal (in-group) elements are detected in
the scattering matrix of input MGXS data, which is a common feature
of transport corrected MGXS data.
*Default*: 1.0
----------------------------------
``<resonance_scattering>`` Element
----------------------------------
@ -421,6 +581,17 @@ pseudo-random number generator.
*Default*: 1
--------------------
``<stride>`` Element
--------------------
The ``stride`` element is used to specify how many random numbers are allocated
for each source particle history.
*Default*: 152,917
.. _source_element:
--------------------
``<source>`` Element
--------------------
@ -438,24 +609,29 @@ attributes/sub-elements:
*Default*: 1.0
:type:
Indicator of source type. One of ``independent``, ``file``, ``compiled``, or
``mesh``. The type of the source will be determined by this attribute if it
is present.
:particle:
The source particle type, either ``neutron`` or ``photon``.
*Default*: neutron
:file:
If this attribute is given, it indicates that the source is to be read from
a binary source file whose path is given by the value of this element. Note,
the number of source sites needs to be the same as the number of particles
simulated in a fission source generation.
If this attribute is given, it indicates that the source type is ``file``,
meaning particles are to be read from a binary source file whose path is
given by the value of this element.
*Default*: None
:library:
If this attribute is given, it indicates that the source is to be
instantiated from an externally compiled source function. This source can be
as complex as is required to define the source for your problem. The library
has a few basic requirements:
If this attribute is given, it indicates that the source type is
``compiled``, meaning that particles are instantiated from an externally
compiled source function. This source can be completely customized as needed
to define the source for your problem. The library has a few basic
requirements:
* It must contain a class that inherits from ``openmc::Source``;
* The class must implement a function called ``sample()``;
@ -463,16 +639,15 @@ attributes/sub-elements:
as a unique pointer. This function can be used to pass parameters through to
the source from the XML, if needed.
More documentation on how to build sources can be found in :ref:`custom_source`.
*Default*: None
More documentation on how to build sources can be found in
:ref:`compiled_source`.
:parameters:
If this attribute is given, it provides the parameters to pass through to the
class generated using the ``library`` parameter . More documentation on how to
build parametrized sources can be found in :ref:`parameterized_custom_source`.
*Default*: None
If this attribute is given, it indicated that the source type is
``compiled``. Its value provides the parameters to pass through to the class
generated using the ``library`` parameter. More documentation on how to
build parametrized sources can be found in
:ref:`parameterized_compiled_source`.
:space:
An element specifying the spatial distribution of source sites. This element
@ -480,19 +655,37 @@ attributes/sub-elements:
:type:
The type of spatial distribution. Valid options are "box", "fission",
"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"
"point", "cartesian", "cylindrical", "spherical", "mesh", and "cloud".
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).
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-, cos_theta-, and phi-coordinates where cos_theta is the cosine of the
angle with respect to the z-axis, phi is the azimuthal angle, and the
sphere is centered on the coordinate (x0,y0,z0).
A "mesh" spatial distribution samples source sites from a mesh element
based on the relative strengths provided in the node. Source locations
within an element are sampled isotropically. If no strengths are provided,
the space within the mesh is uniformly sampled.
A "cloud" spatial distribution samples source sites from a list of spatial
positions provided in the node, based on the relative strengths provided
in the node. If no strengths are provided, the positions are uniformly
sampled.
*Default*: None
@ -559,6 +752,26 @@ attributes/sub-elements:
For "cylindrical and "spherical" distributions, this element specifies
the coordinates for the origin of the coordinate system.
:mesh_id:
For "mesh" spatial distributions, this element specifies which mesh ID to
use for the geometric description of the mesh.
:coords:
For "cloud" distributions, this element specifies a list of coordinates
for each of the points in the cloud.
:strengths:
For "mesh" and "cloud" spatial distributions, this element specifies the
relative source strength of each mesh element or each point in the cloud.
:volume_normalized:
For "mesh" spatial distrubtions, this optional boolean element specifies
whether the vector of relative strengths should be multiplied by the mesh
element volume. This is most common if the strengths represent a source
per unit volume.
*Default*: false
:angle:
An element specifying the angular distribution of source sites. This element
has the following attributes:
@ -606,6 +819,47 @@ attributes/sub-elements:
*Default*: false
:mesh:
For mesh sources, this indicates the ID of the corresponding mesh.
:source:
For mesh sources, this sub-element specifies the source for an individual
mesh element and follows the format for :ref:`source_element`. The number of
``<source>`` sub-elements should correspond to the number of mesh elements.
:constraints:
This sub-element indicates the presence of constraints on sampled source
sites (see :ref:`usersguide_source_constraints` for details). It may have
the following sub-elements:
:domain_ids:
The unique IDs of domains for which source sites must be within.
*Default*: None
:domain_type:
The type of each domain for source rejection ("cell", "material", or
"universe").
*Default*: None
:fissionable:
A boolean indicating whether source sites must be sampled within a
material that is fissionable in order to be accepted.
:time_bounds:
A pair of times in [s] indicating the lower and upper bound for a time
interval that source particles must be within.
:energy_bounds:
A pair of energies in [eV] indicating the lower and upper bound for an
energy interval that source particles must be within.
:rejection_strategy:
Either "resample", indicating that source sites should be resampled when
one is rejected, or "kill", indicating that a rejected source site is
assigned zero weight.
.. _univariate:
Univariate Probability Distributions
@ -673,6 +927,16 @@ variable and whose sub-elements/attributes are as follows:
:dist:
This sub-element of a ``pair`` element provides information on the corresponding univariate distribution.
---------------------------------------
``<source_rejection_fraction>`` Element
---------------------------------------
The ``<source_rejection_fraction>`` element specifies the minimum fraction of
external source sites that must be accepted when applying rejection sampling
based on constraints.
*Default*: 0.05
-------------------------
``<state_point>`` Element
-------------------------
@ -731,27 +995,39 @@ attributes/sub-elements:
*Default*: false
---------------------------
``<surf_src_read>`` Element
---------------------------
:mcpl:
If this element is set to "true", the source point file containing the
source bank will be written as an MCPL_ file name ``source.mcpl`` instead of
an HDF5 file. This option is only applicable if the ``<separate>`` element
is set to true.
The ``<surf_src_read>`` element specifies a surface source file for OpenMC to
read source bank for initializing histories.
This element has the following attributes/sub-elements:
*Default*: false
------------------------------
``<surf_source_read>`` Element
------------------------------
The ``<surf_source_read>`` element specifies a surface source file for OpenMC to
read source bank for initializing histories. This element has the following
attributes/sub-elements:
:path:
Absolute or relative path to a surface source file to read in source bank.
*Default*: ``surface_source.h5`` in current working directory
----------------------------
``<surf_src_write>`` Element
----------------------------
-------------------------------
``<surf_source_write>`` Element
-------------------------------
The ``<surf_src_write>`` element triggers OpenMC to bank particles crossing
The ``<surf_source_write>`` element triggers OpenMC to bank particles crossing
certain surfaces and write out the source bank in a separate file called
``surface_source.h5``.
This element has the following attributes/sub-elements:
``surface_source.h5``. One or multiple surface IDs and one cell ID can be used
to select the surfaces of interest. If no surface IDs are declared, every surface
of the model is eligible to bank particles. In that case, a cell ID (using
either the ``cell``, ``cellfrom`` or ``cellto`` attributes) can be used to select
every surface of a specific cell. This element has the following
attributes/sub-elements:
:surface_ids:
A list of integers separated by spaces indicating the unique IDs of surfaces
@ -767,6 +1043,53 @@ This element has the following attributes/sub-elements:
*Default*: None
:max_source_files:
An integer value indicating the number of surface source files to be written
containing the maximum number of particles each. The surface source bank
will be cleared in simulation memory each time a surface source file is
written. By default a ``surface_source.h5`` file will be created when the
maximum number of saved particles is reached.
*Default*: 1
:mcpl:
An optional boolean which indicates if the banked particles should be
written to a file in the MCPL_-format instead of the native HDF5-based
format. If activated the output file name is changed to
``surface_source.mcpl``.
*Default*: false
.. _MCPL: https://mctools.github.io/mcpl/mcpl.pdf
:cell:
An integer representing the cell ID used to determine if particles crossing
identified surfaces are to be banked. Particles coming from or going to this
declared cell will be banked if they cross the identified surfaces.
*Default*: None
:cellfrom:
An integer representing the cell ID used to determine if particles crossing
identified surfaces are to be banked. Particles coming from this declared
cell will be banked if they cross the identified surfaces.
*Default*: None
:cellto:
An integer representing the cell ID used to determine if particles crossing
identified surfaces are to be banked. Particles going to this declared cell
will be banked if they cross the identified surfaces.
*Default*: None
.. note:: The ``cell``, ``cellfrom`` and ``cellto`` attributes cannot be
used simultaneously.
.. note:: Surfaces with boundary conditions that are not "transmission" or "vacuum"
are not eligible to store any particles when using ``cell``, ``cellfrom``
or ``cellto`` attributes. It is recommended to use surface IDs instead.
------------------------------
``<survival_biasing>`` Element
------------------------------
@ -832,7 +1155,9 @@ cell, the nearest temperature at which cross sections are given is to be
applied, within a given tolerance (see :ref:`temperature_tolerance`). A value of
"interpolation" indicates that cross sections are to be linear-linear
interpolated between temperatures at which nuclear data are present (see
:ref:`temperature_treatment`).
:ref:`temperature_treatment`). With the "interpolation" method, temperatures
outside of the bounds of the nuclear data may be accepted, provided they still
fall within the tolerance (see :ref:`temperature_tolerance`).
*Default*: "nearest"
@ -871,7 +1196,12 @@ The ``<temperature_tolerance>`` element specifies a tolerance in Kelvin that is
to be applied when the "nearest" temperature method is used. For example, if a
cell temperature is 340 K and the tolerance is 15 K, then the closest
temperature in the range of 325 K to 355 K will be used to evaluate cross
sections.
sections. If the ``<temperature_method>`` is "interpolation", the tolerance
specified applies to cell temperatures outside of the data bounds. For example,
if a cell is specified at 695K, a tolerance of 15K and data is only available
at 700K and 1000K, the cell's cross sections will be evaluated at 700K, since
the desired temperature of 695K is within the tolerance of the actual data
despite not being bounded on both sides.
*Default*: 10 K
@ -986,8 +1316,14 @@ The ``<volume_calc>`` element indicates that a stochastic volume calculation
should be run at the beginning of the simulation. This element has the following
sub-elements/attributes:
:cells:
The unique IDs of cells for which the volume should be estimated.
:domain_type:
The type of each domain for the volume calculation ("cell", "material", or
"universe").
*Default*: None
:domain_ids:
The unique IDs of domains for which the volume should be estimated.
*Default*: None
@ -997,16 +1333,41 @@ sub-elements/attributes:
*Default*: None
:lower_left:
The lower-left Cartesian coordinates of a bounding box that is used to
sample points within.
The lower-left Cartesian coordinates of a bounding box that is used to
sample points within.
*Default*: None
*Default*: None
:upper_right:
The upper-right Cartesian coordinates of a bounding box that is used to
sample points within.
The upper-right Cartesian coordinates of a bounding box that is used to
sample points within.
*Default*: None
*Default*: None
:threshold:
Presence of a ``<threshold>`` sub-element indicates that the volume
calculation will be halted based on a threshold on the error. It has the
following sub-elements/attributes:
:type:
The type of the trigger. Accepted options are "variance", "std_dev",
and "rel_err".
:variance:
Variance of the mean, :math:`\sigma^2`
:std_dev:
Standard deviation of the mean, :math:`\sigma`
:rel_err:
Relative error of the mean, :math:`\frac{\sigma}{\mu}`
*Default*: None
:threshold:
The trigger's convergence criterion for the given type.
*Default*: None
----------------------------
``<weight_windows>`` Element
@ -1027,7 +1388,7 @@ sub-elements/attributes:
:particle_type:
The particle that the weight windows will apply to (e.g., 'neutron')
*Default*: None
*Default*: 'neutron'
:energy_bins:
Monotonically increasing list of bounding energies in [eV] to be used for
@ -1065,3 +1426,92 @@ sub-elements/attributes:
Threshold below which particles will be terminated
*Default*: :math:`10^{-38}`
--------------------------------------
``<weight_window_generator>`` Element
--------------------------------------
The ``<weight_window_generator>`` element provides information for creating a set of
mesh-based weight windows.
:mesh:
ID of a mesh that is to be used for the weight windows spatial bins
*Default*: None
:energy_bounds:
The weight window energy bounds. If not present, the max/min energy of the
cross section data is applied as a single energy bin.
*Default*: None
:particle_type:
The particle that the weight windows will apply to (e.g., 'neutron')
*Default*: neutron
:max_realizations:
The number of tally realizations after which the weight windows will stop updating.
*Default*: 1
:update_interval:
The number of tally realizations between weight window updates.
*Default*: 1
:on_the_fly:
Controls whether or not the tally results are reset after a weight window update.
*Default*: true
:method:
Method used to update weight window values (one of 'magic' or 'fw_cadis')
*Default*: magic
:update_parameters:
Method-specific update parameters used when generating/updating weight windows.
For MAGIC:
:value:
The type of tally value to use when creating weight windows (one of 'mean' or 'rel_err')
*Default*: 'mean'
:threshold:
The relative error threshold above which tally results will be ignored.
*Default*: 1.0
:ratio:
The ratio of the lower to upper weight window bounds.
*Default*: 5.0
---------------------------------------
``<weight_window_checkpoints>`` Element
---------------------------------------
The ``<weight_window_checkpoints>`` element indicates the checkpoints for weight
window split/roulette (surface, collision or both). This element has the
following sub-elements/attributes:
:surface:
If set to "true", weight window checks will be performed at surface
crossings.
*Default*: False
:collision:
If set to "true", weight window checks will be performed at collisions.
*Default*: True
--------------------------------------
``<weight_windows_file>`` Element
--------------------------------------
The ``weight_windows_file`` element has no attributes and contains the path to
a weight windows HDF5 file to load during simulation initialization.

View file

@ -4,7 +4,7 @@
State Point File Format
=======================
The current version of the statepoint file format is 17.0.
The current version of the statepoint file format is 18.1.
**/**
@ -23,6 +23,7 @@ The current version of the statepoint file format is 17.0.
bank is present (1) or not (0).
:Datasets: - **seed** (*int8_t*) -- Pseudo-random number generator seed.
- **stride** (*uint64_t*) -- Pseudo-random number generator stride.
- **energy_mode** (*char[]*) -- Energy mode of the run, either
'continuous-energy' or 'multi-group'.
- **run_mode** (*char[]*) -- Run mode used, either 'eigenvalue' or
@ -68,20 +69,44 @@ The current version of the statepoint file format is 17.0.
:Attributes: - **n_meshes** (*int*) -- Number of meshes in the problem.
- **ids** (*int[]*) -- User-defined unique ID of each mesh.
.. _mesh-spec-hdf5:
**/tallies/meshes/mesh <uid>/**
:Datasets: - **type** (*char[]*) -- Type of mesh.
:Attributes: - **id** (*int*) -- ID of the mesh
:Datasets: - **name** (*char[]*) -- Name of the mesh.
- **type** (*char[]*) -- Type of mesh.
- **dimension** (*int*) -- Number of mesh cells in each dimension.
- **lower_left** (*double[]*) -- Coordinates of lower-left corner of
mesh.
- **upper_right** (*double[]*) -- Coordinates of upper-right corner
of mesh.
- **width** (*double[]*) -- Width of each mesh cell in each
dimension.
- **Regular Mesh Only:**
- **lower_left** (*double[]*) -- Coordinates of lower-left corner of
mesh.
- **upper_right** (*double[]*) -- Coordinates of upper-right corner
of mesh.
- **width** (*double[]*) -- Width of each mesh cell in each
dimension.
- **Rectilinear Mesh Only:**
- **x_grid** (*double[]*) -- Mesh divisions along the x-axis.
- **y_grid** (*double[]*) -- Mesh divisions along the y-axis.
- **z_grid** (*double[]*) -- Mesh divisions along the z-axis.
- **Cylindrical & Spherical Mesh Only:**
- **r_grid** (*double[]*) -- The mesh divisions along the r-axis.
- **phi_grid** (*double[]*) -- The mesh divisions along the phi-axis.
- **origin** (*double[]*) -- The origin in cartesian coordinates.
- **Spherical Mesh Only:**
- **theta_grid** (*double[]*) -- The mesh divisions along the theta-axis.
- **Unstructured Mesh Only:**
- **filename** (*char[]*) -- Name of the mesh file.
- **library** (*char[]*) -- Mesh library used to represent the
mesh ("moab" or "libmesh").
- **length_multiplier** (*double*) Scaling factor applied to the mesh.
- **options** (*char[]*) -- Special options that control spatial
search data structures used.
- **volumes** (*double[]*) -- Volume of each mesh cell.
- **centroids** (*double[]*) -- Location of the mesh cell
centroids.
- **vertices** (*double[]*) -- x, y, z values of the mesh vertices.
- **connectivity** (*int[]*) -- Connectivity array for the mesh
cells.
- **element_types** (*int[]*) -- Mesh element types.
**/tallies/filters/**
@ -103,6 +128,10 @@ The current version of the statepoint file format is 17.0.
- **y** (*double[]*) -- Interpolant values for energyfunction
interpolation. Only used for 'energyfunction' filters.
:Attributes:
- **interpolation** (*int*) -- Interpolation type. Only used for
'energyfunction' filters.
**/tallies/derivatives/derivative <id>/**
:Datasets: - **independent variable** (*char[]*) -- Independent variable of
@ -118,6 +147,8 @@ The current version of the statepoint file format is 17.0.
- **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.
- **multiply_density** (*int*) -- Flag indicating whether reaction
rates should be multiplied by atom density (1) or not (0).
:Datasets: - **n_realizations** (*int*) -- Number of realizations.
- **n_filters** (*int*) -- Number of filters used.
@ -149,7 +180,7 @@ All values are given in seconds and are measured on the master process.
finalization.
- **transport** (*double*) -- Time spent transporting particles.
- **inactive batches** (*double*) -- Time spent in the inactive
batches (including non-transport activities like communcating
batches (including non-transport activities like communicating
sites).
- **active batches** (*double*) -- Time spent in the active batches
(including non-transport activities like communicating sites).

View file

@ -4,7 +4,7 @@
Summary File Format
===================
The current version of the summary file format is 6.0.
The current version of the summary file format is 6.1.
**/**
@ -38,6 +38,7 @@ The current version of the summary file format is 6.0.
is an array if the cell uses distributed materials, otherwise it is
a scalar.
- **temperature** (*double[]*) -- Temperature of the cell in Kelvin.
- **density** (*double[]*) -- Density of the cell in [g/cm3].
- **translation** (*double[3]*) -- Translation applied to the fill
universe. This dataset is present only if fill_type is set to
'universe'.
@ -60,9 +61,11 @@ The current version of the summary file format is 6.0.
- **coefficients** (*double[]*) -- Array of coefficients that define
the surface. See :ref:`surface_element` for what coefficients are
defined for each surface type.
- **boundary_condition** (*char[]*) -- Boundary condition applied to
the surface. Can be 'transmission', 'vacuum', 'reflective', or
'periodic'.
- **boundary_type** (*char[]*) -- Boundary condition applied to
the surface. Can be 'transmission', 'vacuum', 'reflective',
'periodic', or 'white'.
- **albedo** (*double*) -- Boundary albedo as a positive multiplier
of particle weight. If absent, it is assumed to be 1.0.
- **geom_type** (*char[]*) -- Type of geometry used to create the cell.
Either 'csg' or 'dagmc'.

View file

@ -40,15 +40,15 @@ The ``<tally>`` element accepts the following sub-elements:
:nuclides:
If specified, the scores listed will be for particular nuclides, not the
summation of reactions from all nuclides. The format for nuclides should be
[Atomic symbol]-[Mass number], e.g. "U-235". The reaction rate for all
summation of reactions from all nuclides. Nuclides are expressed using the
GNDS naming convention, e.g. "U235" or "Am242_m1". The reaction rate for all
nuclides can be obtained with "total". For example, to obtain the reaction
rates for U-235, Pu-239, and all nuclides in a material, this element should
rates for U235, Pu239, and all nuclides in a material, this element should
be:
.. code-block:: xml
<nuclides>U-235 Pu-239 total</nuclides>
<nuclides>U235 Pu239 total</nuclides>
*Default*: total
@ -69,6 +69,12 @@ The ``<tally>`` element accepts the following sub-elements:
list of valid scores can be found in the :ref:`user's guide
<usersguide_scores>`.
:multiply_density:
A boolean that indicates whether reaction rate scores should be computed by
multiplying by the atom density of a nuclide present in a material.
*Default*: true
:trigger:
Precision trigger applied to all filter bins and nuclides for this tally.
It must specify the trigger's type, threshold and scores to which it will
@ -94,6 +100,18 @@ The ``<tally>`` element accepts the following sub-elements:
*Default*: None
:ignore_zeros:
Whether to allow zero tally bins to be ignored when assessing the
convergece of the precision trigger. If True, only nonzero tally scores
will be compared to the trigger's threshold.
.. note:: The ``ignore_zeros`` option can cause the tally trigger to fire
prematurely if there are no hits in any bins at the first
evalulation. It is the user's responsibility to specify enough
particles per batch to get a nonzero score in at least one bin.
*Default*: False
:scores:
The score(s) in this tally to which the trigger should be applied.
@ -311,6 +329,11 @@ If a mesh is desired as a filter for a tally, it must be specified in a separate
element with the tag name ``<mesh>``. This element has the following
attributes/sub-elements:
:name:
An optional string name to identify the mesh in output files.
*Default*: ""
:type:
The type of mesh. This can be either "regular", "rectilinear",
"cylindrical", "spherical", or "unstructured".
@ -351,10 +374,17 @@ attributes/sub-elements:
:theta_grid:
The mesh divisions along the theta-axis. (For spherical mesh only.)
:origin:
The origin in cartesian coordinates. (For cylindrical and spherical meshes only.)
:library:
The mesh library used to represent an unstructured mesh. This can be either
"moab" or "libmesh". (For unstructured mesh only.)
:options:
Special options that control spatial search data structures used. (For
unstructured mesh using MOAB only)
:filename:
The name of the mesh file to be loaded at runtime. (For unstructured mesh
only.)

View file

@ -4,18 +4,34 @@
Track File Format
=================
The current revision of the particle track file format is 2.0.
The current revision of the particle track file format is 3.0.
**/**
:Attributes: - **filetype** (*char[]*) -- String indicating the type of file.
- **version** (*int[2]*) -- Major and minor version of the track
file format.
- **n_particles** (*int*) -- Number of particles for which tracks
are recorded.
- **n_coords** (*int[]*) -- Number of coordinates for each
particle.
:Datasets:
- **coordinates_<i>** (*double[][3]*) -- (x,y,z) coordinates for the
*i*-th particle.
- **track_<b>_<g>_<p>** (Compound type) -- Particle track information
for source particle in batch *b*, generation *g*, and particle
number *p*. particle. The compound type has fields ``r``, ``u``,
``E``, ``time``, ``wgt``, ``cell_id``, ``cell_instance``, and
``material_id``, which represent the position (each coordinate in
[cm]), direction, energy in [eV], time in [s], weight, cell ID,
cell instance, and material ID, respectively. When the particle is
present in a cell with no material assigned, the material ID is
given as -1. Note that this array contains information for one or
more primary/secondary particles originating. The starting index
for each primary/secondary particle is given by the ``offsets``
attribute.
:Attributes: - **n_particles** (*int*) -- Number of
primary/secondary particles for the source history.
- **offsets** (*int[]*) Offset (starting index) into
the array for each primary/secondary particle. The
last offset should match the total size of the
array.
- **particles** (*int[]*) -- Particle type for each
primary/secondary particle (0=neutron, 1=photon,
2=electron, 3=positron).

View file

@ -0,0 +1,39 @@
.. _io_weight_windows:
====================
Weight Window Format
====================
The current revision of the weight window file format is 1.0.
**/**
:Attributes: - **filetype** (*char[]*) -- String indicating the type of file.
- **version** (*int[2]*) -- Major and minor version of the weight
window file format.
**/weight_windows/**
:Attributes: - **n_weight_windows** (*int*) -- Number of weight window objects in the file.
- **ids** (*int[]*) -- Unique IDs of weight window objects in the file.
**/weight_windows/weight_windows_<uid>/**
:Datasets: - **mesh** (*int*) -- ID of the mesh associated with the weight window object.
- **particle_type** (*char[]*) -- Particle type to which the weight windows apply.
- **energy_bounds** (*double[]*) -- Energy bounds of the weight windows in [eV]
- **lower_ww_bounds** (*double[]*) -- Weight window lower bounds.
- **upper_ww_bounds** (*double[]*) -- Weight window upper bounds.
- **survival_ratio** (*double*) -- Weight window survival ratio.
- **max_lower_bound_ratio** (*double*) -- Maximum particle weight to lower weight window bound ratio.
- **max_split** (*int*) -- Maximum number of splits per weight window check.
- **weight_cutoff** (*double*) -- Particle weight cutoff.
**/meshes/**
:Attributes: - **n_meshes** (*int*) -- Number of meshes in the file.
- **ids** (*int[]*) -- User-defined unique ID of each mesh.
**/meshes/mesh <uid>/**
Please see the section on **/tallies/meshes/** in the :doc:`statepoint`.

View file

@ -4,7 +4,7 @@
License Agreement
=================
Copyright © 2011-2022 Massachusetts Institute of Technology, UChicago Argonne
Copyright © 2011-2025 Massachusetts Institute of Technology, UChicago Argonne
LLC, and OpenMC contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of

View file

@ -0,0 +1,362 @@
.. _methods_charged_particle_physics:
========================
Charged Particle Physics
========================
OpenMC neglects the spatial transport of charged particles (electrons and
positrons), assuming they deposit all their energy locally and produce
bremsstrahlung photons at their birth location. This approximation, called
thick-target bremsstrahlung (TTB) approximation is justified by the fact that
charged particles have much shorter stopping ranges compared to neutrons and
photons, especially in high-density materials.
-----------------------------
Charged Particle Interactions
-----------------------------
Bremsstrahlung
--------------
When a charged particle is decelerated in the field of an atom, some of its
kinetic energy is converted into electromagnetic radiation known as
bremsstrahlung, or 'braking radiation'. In each event, an electron or positron
with kinetic energy :math:`T` generates a photon with an energy :math:`E`
between :math:`0` and :math:`T`. Bremsstrahlung is described by a cross section
that is differential in photon energy, in the direction of the emitted photon,
and in the final direction of the charged particle. However, in Monte Carlo
simulations it is typical to integrate over the angular variables to obtain a
single differential cross section with respect to photon energy, which is often
expressed in the form
.. math::
:label: bremsstrahlung-dcs
\frac{d\sigma_{\text{br}}}{dE} = \frac{Z^2}{\beta^2} \frac{1}{E}
\chi(Z, T, \kappa),
where :math:`\kappa = E/T` is the reduced photon energy and :math:`\chi(Z, T,
\kappa)` is the scaled bremsstrahlung cross section, which is experimentally
measured.
Because electrons are attracted to atomic nuclei whereas positrons are
repulsed, the cross section for positrons is smaller, though it approaches that
of electrons in the high energy limit. To obtain the positron cross section, we
multiply :eq:`bremsstrahlung-dcs` by the :math:`\kappa`-independent factor used
in Salvat_,
.. math::
:label: positron-factor
\begin{aligned}
F_{\text{p}}(Z,T) =
& 1 - \text{exp}(-1.2359\times 10^{-1}t + 6.1274\times 10^{-2}t^2 - 3.1516\times 10^{-2}t^3 \\
& + 7.7446\times 10^{-3}t^4 - 1.0595\times 10^{-3}t^5 + 7.0568\times 10^{-5}t^6 \\
& - 1.8080\times 10^{-6}t^7),
\end{aligned}
where
.. math::
:label: positron-factor-t
t = \ln\left(1 + \frac{10^6}{Z^2}\frac{T}{\text{m}_\text{e}c^2} \right).
:math:`F_{\text{p}}(Z,T)` is the ratio of the radiative stopping powers for
positrons and electrons. Stopping power describes the average energy loss per
unit path length of a charged particle as it passes through matter:
.. math::
:label: stopping-power
-\frac{dT}{ds} = n \int E \frac{d\sigma}{dE} dE \equiv S(T),
where :math:`n` is the number density of the material and :math:`d\sigma/dE` is
the cross section differential in energy loss. The total stopping power
:math:`S(T)` can be separated into two components: the radiative stopping
power :math:`S_{\text{rad}}(T)`, which refers to energy loss due to
bremsstrahlung, and the collision stopping power :math:`S_{\text{col}}(T)`,
which refers to the energy loss due to inelastic collisions with bound
electrons in the material that result in ionization and excitation. The
radiative stopping power for electrons is given by
.. math::
:label: radiative-stopping-power
S_{\text{rad}}(T) = n \frac{Z^2}{\beta^2} T \int_0^1 \chi(Z,T,\kappa)
d\kappa.
To obtain the radiative stopping power for positrons,
:eq:`radiative-stopping-power` is multiplied by :eq:`positron-factor`.
While the models for photon interactions with matter described above can safely
assume interactions occur with free atoms, sampling the target atom based on
the macroscopic cross sections, molecular effects cannot necessarily be
disregarded for charged particle treatment. For compounds and mixtures, the
bremsstrahlung cross section is calculated using Bragg's additivity rule as
.. math::
:label: material-bremsstrahlung-dcs
\frac{d\sigma_{\text{br}}}{dE} = \frac{1}{\beta^2 E} \sum_i \gamma_i Z^2_i
\chi(Z_i, T, \kappa),
where the sum is over the constituent elements and :math:`\gamma_i` is the
atomic fraction of the :math:`i`-th element. Similarly, the radiative stopping
power is calculated using Bragg's additivity rule as
.. math::
:label: material-radiative-stopping-power
S_{\text{rad}}(T) = \sum_i w_i S_{\text{rad},i}(T),
where :math:`w_i` is the mass fraction of the :math:`i`-th element and
:math:`S_{\text{rad},i}(T)` is found for element :math:`i` using
:eq:`radiative-stopping-power`. The collision stopping power, however, is a
function of certain quantities such as the mean excitation energy :math:`I` and
the density effect correction :math:`\delta_F` that depend on molecular
properties. These quantities cannot simply be summed over constituent elements
in a compound, but should instead be calculated for the material. The Bethe
formula can be used to find the collision stopping power of the material:
.. math::
:label: material-collision-stopping-power
S_{\text{col}}(T) = \frac{2 \pi r_e^2 m_e c^2}{\beta^2} N_A \frac{Z}{A_M}
[\ln(T^2/I^2) + \ln(1 + \tau/2) + F(\tau) - \delta_F(T)],
where :math:`N_A` is Avogadro's number, :math:`A_M` is the molar mass,
:math:`\tau = T/m_e`, and :math:`F(\tau)` depends on the particle type. For
electrons,
.. math::
:label: F-electron
F_{-}(\tau) = (1 - \beta^2)[1 + \tau^2/8 - (2\tau + 1) \ln2],
while for positrons
.. math::
:label: F-positron
F_{+}(\tau) = 2\ln2 - (\beta^2/12)[23 + 14/(\tau + 2) + 10/(\tau + 2)^2 +
4/(\tau + 2)^3].
The density effect correction :math:`\delta_F` takes into account the reduction
of the collision stopping power due to the polarization of the material the
charged particle is passing through by the electric field of the particle.
It can be evaluated using the method described by Sternheimer_, where the
equation for :math:`\delta_F` is
.. math::
:label: density-effect-correction
\delta_F(\beta) = \sum_{i=1}^n f_i \ln[(l_i^2 + l^2)/l_i^2] -
l^2(1-\beta^2).
Here, :math:`f_i` is the oscillator strength of the :math:`i`-th transition,
given by :math:`f_i = n_i/Z`, where :math:`n_i` is the number of electrons in
the :math:`i`-th subshell. The frequency :math:`l` is the solution of the
equation
.. math::
:label: density-effect-l
\frac{1}{\beta^2} - 1 = \sum_{i=1}^{n} \frac{f_i}{\bar{\nu}_i^2 + l^2},
where :math:`\bar{v}_i` is defined as
.. math::
:label: density-effect-nubar
\bar{\nu}_i = h\nu_i \rho / h\nu_p.
The plasma energy :math:`h\nu_p` of the medium is given by
.. math::
:label: plasma-frequency
h\nu_p = \sqrt{\frac{(hc)^2 r_e \rho_m N_A Z}{\pi A}},
where :math:`A` is the atomic weight and :math:`\rho_m` is the density of the
material. In :eq:`density-effect-nubar`, :math:`h\nu_i` is the oscillator
energy, and :math:`\rho` is an adjustment factor introduced to give agreement
between the experimental values of the oscillator energies and the mean
excitation energy. The :math:`l_i` in :eq:`density-effect-correction` are
defined as
.. math::
:label: density-effect-li
\begin{aligned}
l_i &= (\bar{\nu}_i^2 + 2/3f_i)^{1/2} ~~~~&\text{for}~~ \bar{\nu}_i > 0 \\
l_n &= f_n^{1/2} ~~~~&\text{for}~~ \bar{\nu}_n = 0,
\end{aligned}
where the second case applies to conduction electrons. For a conductor,
:math:`f_n` is given by :math:`n_c/Z`, where :math:`n_c` is the effective
number of conduction electrons, and :math:`v_n = 0`. The adjustment factor
:math:`\rho` is determined using the equation for the mean excitation energy:
.. math::
:label: mean-excitation-energy
\ln I = \sum_{i=1}^{n-1} f_i \ln[(h\nu_i\rho)^2 + 2/3f_i(h\nu_p)^2]^{1/2} +
f_n \ln (h\nu_pf_n^{1/2}).
.. _ttb:
Thick-Target Bremsstrahlung Approximation
+++++++++++++++++++++++++++++++++++++++++
Since charged particles lose their energy on a much shorter distance scale than
neutral particles, not much error should be introduced by neglecting to
transport electrons. However, the bremsstrahlung emitted from high energy
electrons and positrons can travel far from the interaction site. Thus, even
without a full electron transport mode it is necessary to model bremsstrahlung.
We use a thick-target bremsstrahlung (TTB) approximation based on the models in
Salvat_ and Kaltiaisenaho_ for generating bremsstrahlung photons, which assumes
the charged particle loses all its energy in a single homogeneous material
region.
To model bremsstrahlung using the TTB approximation, we need to know the number
of photons emitted by the charged particle and the energy distribution of the
photons. These quantities can be calculated using the continuous slowing down
approximation (CSDA). The CSDA assumes charged particles lose energy
continuously along their trajectory with a rate of energy loss equal to the
total stopping power, ignoring fluctuations in the energy loss. The
approximation is useful for expressing average quantities that describe how
charged particles slow down in matter. For example, the CSDA range approximates
the average path length a charged particle travels as it slows to rest:
.. math::
:label: csda-range
R(T) = \int^T_0 \frac{dT'}{S(T')}.
Actual path lengths will fluctuate around :math:`R(T)`. The average number of
photons emitted per unit path length is given by the inverse bremsstrahlung
mean free path:
.. math::
:label: inverse-bremsstrahlung-mfp
\lambda_{\text{br}}^{-1}(T,E_{\text{cut}})
= n\int_{E_{\text{cut}}}^T\frac{d\sigma_{\text{br}}}{dE}dE
= n\frac{Z^2}{\beta^2}\int_{\kappa_{\text{cut}}}^1\frac{1}{\kappa}
\chi(Z,T,\kappa)d\kappa.
The lower limit of the integral in :eq:`inverse-bremsstrahlung-mfp` is non-zero
because the bremsstrahlung differential cross section diverges for small photon
energies but is finite for photon energies above some cutoff energy
:math:`E_{\text{cut}}`. The mean free path
:math:`\lambda_{\text{br}}^{-1}(T,E_{\text{cut}})` is used to calculate the
photon number yield, defined as the average number of photons emitted with
energy greater than :math:`E_{\text{cut}}` as the charged particle slows down
from energy :math:`T` to :math:`E_{\text{cut}}`. The photon number yield is
given by
.. math::
:label: photon-number-yield
Y(T,E_{\text{cut}}) = \int^{R(T)}_{R(E_{\text{cut}})}
\lambda_{\text{br}}^{-1}(T',E_{\text{cut}})ds = \int_{E_{\text{cut}}}^T
\frac{\lambda_{\text{br}}^{-1}(T',E_{\text{cut}})}{S(T')}dT'.
:math:`Y(T,E_{\text{cut}})` can be used to construct the energy spectrum of
bremsstrahlung photons: the number of photons created with energy between
:math:`E_1` and :math:`E_2` by a charged particle with initial kinetic energy
:math:`T` as it comes to rest is given by :math:`Y(T,E_1) - Y(T,E_2)`.
To simulate the emission of bremsstrahlung photons, the total stopping power
and bremsstrahlung differential cross section for positrons and electrons must
be calculated for a given material using :eq:`material-bremsstrahlung-dcs` and
:eq:`material-radiative-stopping-power`. These quantities are used to build the
tabulated bremsstrahlung energy PDF and CDF for that material for each incident
energy :math:`T_k` on the energy grid. The following algorithm is then applied
to sample the photon energies:
1. For an incident charged particle with energy :math:`T`, sample the number of
emitted photons as
.. math::
N = \lfloor Y(T,E_{\text{cut}}) + \xi_1 \rfloor.
2. Rather than interpolate the PDF between indices :math:`k` and :math:`k+1`
for which :math:`T_k < T < T_{k+1}`, which is computationally expensive, use
the composition method and sample from the PDF at either :math:`k` or
:math:`k+1`. Using linear interpolation on a logarithmic scale, the PDF can
be expressed as
.. math::
p_{\text{br}}(T,E) = \pi_k p_{\text{br}}(T_k,E) + \pi_{k+1}
p_{\text{br}}(T_{k+1},E),
where the interpolation weights are
.. math::
\pi_k = \frac{\ln T_{k+1} - \ln T}{\ln T_{k+1} - \ln T_k},~~~
\pi_{k+1} = \frac{\ln T - \ln T_k}{\ln T_{k+1} - \ln T_k}.
Sample either the index :math:`i = k` or :math:`i = k+1` according to the
point probabilities :math:`\pi_{k}` and :math:`\pi_{k+1}`.
3. Determine the maximum value of the CDF :math:`P_{\text{br,max}}`.
3. Sample the photon energies using the inverse transform method with the
tabulated CDF :math:`P_{\text{br}}(T_i, E)` i.e.,
.. math::
E = E_j \left[ (1 + a_j) \frac{\xi_2 P_{\text{br,max}} -
P_{\text{br}}(T_i, E_j)} {E_j p_{\text{br}}(T_i, E_j)} + 1
\right]^{\frac{1}{1 + a_j}}
where the interpolation factor :math:`a_j` is given by
.. math::
a_j = \frac{\ln p_{\text{br}}(T_i,E_{j+1}) - \ln p_{\text{br}}(T_i,E_j)}
{\ln E_{j+1} - \ln E_j}
and :math:`P_{\text{br}}(T_i, E_j) \le \xi_2 P_{\text{br,max}} \le
P_{\text{br}}(T_i, E_{j+1})`.
We ignore the range of the electron or positron, i.e., the bremsstrahlung
photons are produced in the same location that the charged particle was
created. The direction of the photons is assumed to be the same as the
direction of the incident charged particle, which is a reasonable approximation
at higher energies when the bremsstrahlung radiation is emitted at small
angles.
Electron-Positron Annihilation
------------------------------
When a positron collides with an electron, both particles are annihilated and
generally two photons with equal energy are created. If the kinetic energy of
the positron is high enough, the two photons can have different energies, and
the higher-energy photon is emitted preferentially in the direction of flight
of the positron. It is also possible to produce a single photon if the
interaction occurs with a bound electron, and in some cases three (or, rarely,
even more) photons can be emitted. However, the annihilation cross section is
largest for low-energy positrons, and as the positron energy decreases, the
angular distribution of the emitted photons becomes isotropic.
In OpenMC, we assume the most likely case in which a low-energy positron (which
has already lost most of its energy to bremsstrahlung radiation) interacts with
an electron which is free and at rest. Two photons with energy equal to the
electron rest mass energy :math:`m_e c^2 = 0.511` MeV are emitted isotropically
in opposite directions.
.. _Kaltiaisenaho: https://aaltodoc.aalto.fi/bitstream/handle/123456789/21004/master_Kaltiaisenaho_Toni_2016.pdf
.. _Salvat: https://doi.org/10.1787/32da5043-en
.. _Sternheimer: https://doi.org/10.1103/PhysRevB.26.6067

View file

@ -266,11 +266,11 @@ and eq. :eq:`eq_cell_bound` can be written in this generic form,
The parameter :math:`\widetilde{D}_{l,m,n}^{u,g}` represents the linear
coupling term between current and flux. These current relationships can be
sustituted into eq. :eq:`eq_neut_bal` to produce a linear system of multigroup
substituted into eq. :eq:`eq_neut_bal` to produce a linear system of multigroup
diffusion equations for each spatial cell and energy group. However, a solution
to these equations is not consistent with a higher order transport solution
unless equivalence factors are present. This is because both the diffusion
approximation, governed by Fick's Law, and spatial trunction error will produce
approximation, governed by Fick's Law, and spatial truncation error will produce
differences. Therefore, a nonlinear parameter,
:math:`\widehat{D}_{l,m,n}^{u,g}`, is added to eqs. :eq:`eq_cell_cell` and
:eq:`eq_cell_bound`. These equations are, respectively,

View file

@ -9,7 +9,7 @@ Continuous-Energy Data
----------------------
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
for continuous-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
@ -178,6 +178,27 @@ been selected. There are three methods available:
section data is loaded for a single temperature and is used in the
unresolved resonance and fast energy ranges.
------------------
NCrystal materials
------------------
As an alternative of the standard thermal scattering treatment using
:math:`S(\alpha,\beta)` tables, OpenMC allows to create materials using
NCrystal_. In addition to the regular thermal elastic, and thermal inelastic
processes, NCrystal allows the generation of models for materials that cannot
currently included in ACE files such as oriented single crystals (see the
`NCrystal paper`_), and further extend the physics `using plugins`_. Thermal
scattering kernels are generated on the fly from dynamic and structural data, or
loaded from :math:`S(\alpha,\beta)` tables converted from ENDF6 evaluations.
These kernels are sampled in a direct way using a fast `rejection algorithm`_
that does not require previous processing. A `large library`_ of materials is
already included in the NCrystal distribution, and new materials can be easily
defined from scratch in the `NCMAT format`_ or `combining existing files`_.
The compositions of the materials defined in NCrystal are passed on to OpenMC
all other reactions except for thermal neutron scattering are handled by
continuous energy ACE libraries.
----------------
Multi-Group Data
----------------
@ -187,9 +208,10 @@ are represented using a multi-group library format specific to the OpenMC code.
The format is described in the :ref:`mgxs_lib_spec`. The data itself can be
prepared via traditional paths or directly from a continuous-energy OpenMC
calculation by use of the Python API as is shown in an `example notebook
<../examples/mg-mode-part-i.ipynb>`_. This multi-group library consists of
meta-data (such as the energy group structure) and multiple `xsdata` objects
which contains the required microscopic or macroscopic multi-group data.
<https://nbviewer.jupyter.org/github/openmc-dev/openmc-notebooks/blob/main/mg-mode-part-i.ipynb>`_.
This multi-group library consists of meta-data (such as the energy group
structure) and multiple `xsdata` objects which contains the required microscopic
or macroscopic multi-group data.
At a minimum, the library must contain the absorption cross section
(:math:`\sigma_{a,g}`) and a scattering matrix. If the problem is an eigenvalue
@ -268,13 +290,20 @@ scattering information in the water while the fuel can be simulated with linear
or even isotropic scattering.
.. _logarithmic mapping technique:
https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-14-24530.pdf
https://mcnp.lanl.gov/pdf_files/TechReport_2014_LANL_LA-UR-14-24530_Brown.pdf
.. _Hwang: https://doi.org/10.13182/NSE87-A16381
.. _Josey: https://doi.org/10.1016/j.jcp.2015.08.013
.. _WMP Library: https://github.com/mit-crpg/WMP_Library
.. _MCNP: https://mcnp.lanl.gov
.. _Serpent: http://montecarlo.vtt.fi
.. _NJOY: https://www.njoy21.io/NJOY21/
.. _ENDF/B data: https://www.nndc.bnl.gov/endf/b8.0/
.. _Serpent: https://serpent.vtt.fi
.. _NJOY: https://www.njoy21.io/
.. _ENDF/B data: https://www.nndc.bnl.gov/endf-b8.0/
.. _Leppanen: https://doi.org/10.1016/j.anucene.2009.03.019
.. _algorithms: http://ab-initio.mit.edu/wiki/index.php/Faddeeva_Package
.. _algorithms: http://ab-initio.mit.edu/faddeeva/
.. _NCrystal: https://github.com/mctools/ncrystal
.. _NCrystal paper: https://doi.org/10.1016/j.cpc.2019.07.015
.. _using plugins: https://doi.org/10.1016/j.cpc.2021.108082
.. _rejection algorithm: https://doi.org/10.1016/j.jcp.2018.11.043
.. _large library: https://github.com/mctools/ncrystal/wiki/Data-library
.. _NCMAT format: https://github.com/mctools/ncrystal/wiki/NCMAT-format
.. _combining existing files: https://github.com/mctools/ncrystal/wiki/Announcement-Release3.0.0#2-multiphase-materials

View file

@ -103,17 +103,18 @@ integrate over the entire timestep.
Our aim here is not to exhaustively describe all integration methods but rather
to give a few examples that elucidate the main considerations one must take into
account when choosing a method. Generally, there is a tradeoff between the
accuracy of the method and its computational expense. The expense is driven
almost entirely by the time to compute a transport solution, i.e., to evaluate
:math:`\mathbf{A}` for a given :math:`\mathbf{n}`. Thus, the cost of a method
scales with the number of :math:`\mathbf{A}` evaluations that are performed per
timestep. On the other hand, methods that require more evaluations generally
achieve higher accuracy. The predictor method only requires one evaluation and
its error converges as :math:`\mathcal{O}(h)`. The CE/CM method requires two
evaluations and is thus twice as expensive as the predictor method, but achieves
an error of :math:`\mathcal{O}(h^2)`. An exhaustive description of time
integration methods and their merits can be found in the `thesis of Colin Josey
<http://dspace.mit.edu/handle/1721.1/7582>`_.
accuracy of the method and its computational expense. In the case of
transport-coupled depletion, the expense is driven almost entirely by the time
to compute a transport solution, i.e., to evaluate :math:`\mathbf{A}` for a
given :math:`\mathbf{n}`. Thus, the cost of a method scales with the number of
:math:`\mathbf{A}` evaluations that are performed per timestep. On the other
hand, methods that require more evaluations generally achieve higher accuracy.
The predictor method only requires one evaluation and its error converges as
:math:`\mathcal{O}(h)`. The CE/CM method requires two evaluations and is thus
twice as expensive as the predictor method, but achieves an error of
:math:`\mathcal{O}(h^2)`. An exhaustive description of time integration methods
and their merits can be found in the `thesis of Colin Josey
<https://dspace.mit.edu/handle/1721.1/7582>`_.
OpenMC does not rely on a single time integration method but rather has several
classes that implement different algorithms. For example, the
@ -169,12 +170,14 @@ Data Considerations
In principle, solving Eq. :eq:`depletion-matrix` using CRAM is fairly simple:
just construct the burnup matrix at various times and solve a set of sparse
linear systems. However, constructing the burnup matrix itself involves not only
solving the transport equation to estimate transmutation reaction rates but also
a series of choices about what data to include. In OpenMC, the burnup matrix is
constructed based on data inside of a *depletion chain* file, which includes
fundamental data gathered from ENDF incident neutron, decay, and fission product
yield sublibraries. For each nuclide, this file includes:
linear systems. However, constructing the burnup matrix itself involves not
only solving the transport equation to estimate transmutation reaction rates
(in the case of transport-coupled depletion) or to obtain microscopic cross
sections (in the case of transport-independent depletion), but also a series of
choices about what data to include. In OpenMC, the burnup matrix is constructed
based on data inside of a *depletion chain* file, which includes fundamental
data gathered from ENDF incident neutron, decay, and fission product yield
sublibraries. For each nuclide, this file includes:
- What transmutation reactions are possible, their Q values, and their products;
- If a nuclide is not stable, what decay modes are possible, their branching
@ -185,9 +188,12 @@ yield sublibraries. For each nuclide, this file includes:
Transmutation Reactions
-----------------------
OpenMC will setup tallies in a problem based on what transmutation reactions are
available in a depletion chain file, so any arbitrary number of transmutation
reactions can be tracked. The pregenerated chain files that are available on
In transport-coupled depletion, OpenMC will setup tallies in a problem based on
what transmutation reactions are available in a depletion chain file, so any
arbitrary number of transmutation reactions can be tracked. In
transport-independent depletion, OpenMC will calculate reaction rates for every
reaction that is present in both the available cross sections and the depletion
chain file. The pregenerated chain files that are available on
https://openmc.org include the following transmutation reactions: fission, (n,\
:math:`\gamma`\ ), (n,2n), (n,3n), (n,4n), (n,p), and (n,\ :math:`\alpha`\ ).
@ -202,11 +208,12 @@ accurately model the branching of the capture reaction in Am241. This is
complicated by the fact that the branching ratio may depend on the incident
neutron energy causing capture.
OpenMC does not currently allow energy-dependent capture branching ratios.
However, the depletion chain file does allow a transmutation reaction to be
listed multiple times with different branching ratios resulting in different
products. Spectrum-averaged capture branching ratios have been computed in LWR
and SFR spectra and are available at https://openmc.org/depletion-chains.
OpenMC's transport solver does not currently allow energy-dependent capture
branching ratios. However, the depletion chain file does allow a transmutation
reaction to be listed multiple times with different branching ratios resulting
in different products. Spectrum-averaged capture branching ratios have been
computed in LWR and SFR spectra and are available at
https://openmc.org/depletion-chains.
Fission Product Yields
----------------------
@ -217,26 +224,31 @@ energies. It is an open question as to what the best way to handle this energy
dependence is. OpenMC includes three methods for treating the energy dependence
of FPY:
1. Use FPY data corresponding to a specified energy.
1. Use FPY data corresponding to a specified energy. This is used by default in
both transport-coupled and transport-independent depletion.
2. Tally fission rates above and below a specified cutoff energy. Assume that
all fissions below the cutoff energy correspond to thermal FPY data and all
fission above the cutoff energy correspond to fast FPY data.
fission above the cutoff energy correspond to fast FPY data. Only applicable
to transport-coupled depletion.
3. Compute the average energy at which fission events occur and use an effective
FPY by linearly interpolating between FPY provided at neighboring energies.
Only applicable to transport-coupled depletion.
The method can be selected through the ``fission_yield_mode`` argument to the
:class:`openmc.deplete.Operator` constructor.
The method for transport-coupled depletion can be selected through the
``fission_yield_mode`` argument to the :class:`openmc.deplete.CoupledOperator`
constructor.
Power Normalization
-------------------
The reaction rates provided OpenMC are given in units of reactions per source
particle. For depletion, it is necessary to compute an absolute reaction rate in
reactions per second. To do so, the reaction rates are normalized based on a
specified power. A complete description of how this normalization can be
performed is described in :ref:`usersguide_tally_normalization`. Here, we simply
note that the main depletion class, :class:`openmc.deplete.Operator`, allows the
user to choose one of two methods for estimating the heating rate, including:
In transport-coupled depletion, the reaction rates provided OpenMC are given in
units of reactions per source particle. For depletion, it is necessary to
compute an absolute reaction rate in reactions per second. To do so, the
reaction rates are normalized based on a specified power. A complete
description of how this normalization can be performed is described in
:ref:`usersguide_tally_normalization`. Here, we simply note that the main
depletion class, :class:`openmc.deplete.CoupledOperator`, allows the user to
choose one of two methods for estimating the heating rate, including:
1. Using fixed Q values from a depletion chain file (useful for comparisons to
other codes that use fixed Q values), or
@ -244,4 +256,86 @@ user to choose one of two methods for estimating the heating rate, including:
energy-dependent estimate of the true heating rate.
The method for normalization can be chosen through the ``normalization_mode``
argument to the :class:`openmc.deplete.Operator` class.
argument to the :class:`openmc.deplete.CoupledOperator` class.
--------------
Transfer Rates
--------------
OpenMC allows continuous removal or feed of nuclides by adding an
extra transfer rate term to the depletion matrix. An application of this feature
is the chemical processing of Molten Salt Reactors (MSRs), where one can
model the removal of fission products or feeding fresh fuel into the system.
A transfer rate as defined here is the rate at which nuclides are
continuously removed/fed from/to a material.
.. note::
A transfer rate can be positive or negative, indicating removal or feed
respectively.
Mathematically, it can be thought of as an additional term :math:`\mathbf{T}`
in the depletion equation that is proportional to the nuclide density, which can be written as:
.. math::
\begin{aligned}\frac{dN_i(t)}{dt} = &\underbrace{\sum\limits_j f_{j\rightarrow i}
\int_0^\infty dE \; \sigma_j (E,t) \phi(E,t) N_j(t) - \int_0^\infty dE \; \sigma_i(E,t)
\phi(E,t) N_i(t)}_\textbf{R} \\
&+ \underbrace{\sum_j \left [ \lambda_{j\rightarrow i} N_j(t) - \lambda_{i\rightarrow j} N_i(t) \right ]}_\textbf{D} \\
&- \underbrace{t_i N_i(t)}_\textbf{T} \end{aligned}
where the reaction term :math:`\mathbf{R}`, the decay term :math:`\mathbf{D}`
and the new transfer term :math:`\mathbf{T}` have been grouped together so that
:math:`\mathbf{A} = \mathbf{R}+\mathbf{D}-\mathbf{T}`.
The transfer rate coefficient :math:`t_i` defines the continuous transfer of the
nuclide :math:`i`, which behaves similar to radioactive decay.
:math:`t_i` can also be defined as the reciprocal of a cycle time
:math:`T_{cyc}`, intended as the time needed to process the whole inventory.
Note that this formulation assumes homogeneous distribution of nuclide
:math:`i` throughout the material.
A more rigorous description of removal rate and its implementation can be found
in the paper by `Hombourger
<https://doi.org/10.1016/j.anucene.2020.107504>`_.
The resulting burnup matrix can be solved with the same integration algorithms
that are used in the absence of the transfer term.
.. note::
If no ``destination_material`` is specified, nuclides that are removed
or fed will not be tracked afterwards.
Coupling materials
------------------
To keep track of removed nuclides or to feed nuclides from one depletable material
to another, the respective depletion equations have to be coupled. This can be
achieved by defining one block matrix, with diagonal blocks corresponding to
depletion matrices :math:`\mathbf{A_{ii}}`, where the index :math:`i` indicates
the depletable material id, and off-diagonal blocks corresponding to inter-material
coupling matrices :math:`\mathbf{T_{ij}}`, positioned so that that the indices :math:`i` and
:math:`j` indicate the nuclides receiving and losing materials, respectively.
The nuclide vectors are assembled together in one single vector and the resulting
system is solved with the same integration algorithms seen before.
As an example, consider the case of two depletable materials and one
transfer defined from material 1 to material 2. The final system will look like:
.. math::
\begin{aligned}\frac{d}{dt}\begin{pmatrix}\vec{N_1}\\ \vec{N_2}\end{pmatrix} &=
\begin{pmatrix}\mathbf{A_{11}} & \mathbf{0}\\ \mathbf{T_{21}} & \mathbf{A_{22 }}
\end{pmatrix} \begin{pmatrix}\vec{N_1}\\ \vec{N_2}\end{pmatrix} \end{aligned}
where:
:math:`\mathbf{A_{11}} = \mathbf{R_{11}}+\mathbf{D_{11}}-\mathbf{T_{21}}`, and
:math:`\mathbf{A_{22}} = \mathbf{R_{22}}+\mathbf{D_{22}}`.
Note that mass conservation is guaranteed by transferring the number
of atoms directly.

View file

@ -55,15 +55,17 @@ in :ref:`fission-bank-algorithms`.
Source Convergence Issues
-------------------------
.. _methods-shannon-entropy:
Diagnosing Convergence with Shannon Entropy
-------------------------------------------
As discussed earlier, it is necessary to converge both :math:`k_{eff}` and the
source distribution before any tallies can begin. Moreover, the convergence rate
of the source distribution is in general slower than that of
:math:`k_{eff}`. One should thus examine not only the convergence of
:math:`k_{eff}` but also the convergence of the source distribution in order to
make decisions on when to start active batches.
of the source distribution is in general slower than that of :math:`k_{eff}`.
One should thus examine not only the convergence of :math:`k_{eff}` but also the
convergence of the source distribution in order to make decisions on when to
start active batches.
However, the representation of the source distribution makes it a bit more
difficult to analyze its convergence. Since :math:`k_{eff}` is a scalar
@ -108,6 +110,13 @@ at plots of :math:`k_{eff}` and the Shannon entropy. A number of methods have
been proposed (see e.g. [Romano]_, [Ueki]_), but each of these is not without
problems.
Shannon entropy is calculated differently for the random ray solver, as
described :ref:`in the random ray theory section
<methods-shannon-entropy-random-ray>`. Additionally, as the Shannon entropy only
serves as a diagnostic tool for convergence of the fission source distribution,
there is currently no diagnostic to determine if the scattering source
distribution in random ray is converged.
---------------------------
Uniform Fission Site Method
---------------------------
@ -142,7 +151,7 @@ than unity. By ensuring that the expected number of fission sites in each mesh
cell is constant, the collision density across all cells, and hence the variance
of tallies, is more uniform than it would be otherwise.
.. _Shannon entropy: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-06-3737.pdf
.. _Shannon entropy: https://mcnp.lanl.gov/pdf_files/TechReport_2006_LANL_LA-UR-06-3737_Brown.pdf
.. [Lieberoth] J. Lieberoth, "A Monte Carlo Technique to Solve the Static
Eigenvalue Problem of the Boltzmann Transport Equation," *Nukleonik*, **11**,

View file

@ -7,7 +7,7 @@ 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
surrounding electrons 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.
@ -25,19 +25,38 @@ KERMA (Kinetic Energy Release in Materials) [Mack97]_ coefficients for reaction
: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
KERMA coefficients can be computed using the energy-balance method with a
nuclear data processing code like NJOY, which estimates the KERMA coefficients
using the following equation:
.. math::
k_{i, r}(E) = \left(E + Q_{i, r} - \bar{E}_{i, r, n}
k_{i, r}(E) = \left(E + Q_{i, r} - \sum\limits_x \bar{E}_{i, r, x}
\right)\sigma_{i, r}(E),
where the summation is over each secondary particle type :math:`x`. This
equation states that the energy deposited is equal to the energy of the incident
particle plus the reaction :math:`Q` value less the energy of secondary
particles that are transported away from the reaction site. For neutron
interactions, the energy-balance KERMA coefficient is
.. math::
k_{i, r}(E) = \left(E + Q_{i, r} - \sum\limits_x \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.
where :math:`\bar{E}_{i, r, n}` is the average energy of secondary neutrons and
:math:`\bar{E}_{i, r, \gamma}` is the average energy of secondary photons. For
photon and charged particle interactions the KERMA coefficient is
.. math::
:label: energy-balance-photon
k_{i, r}(E) = \left(E + Q_{i, r} - \sum\limits_x \bar{E}_{i, r, x}
\right)\sigma_{i, r}(E).
where the :math:`Q` value is zero for all interactions except for pair
production and positron annihilation.
-------
Fission
@ -120,7 +139,7 @@ run with :math:`N918` reflecting fission heating computed from NJOY.
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
Coupled Neutron-Photon Transport
--------------------------------
Here, OpenMC instructs ``heatr`` to assume that energy from photons is not
@ -138,6 +157,50 @@ Let :math:`N301` represent the total heating number returned from this
This modified heating data is stored as the MT=301 reaction and will be scored
if ``heating`` is included in :attr:`openmc.Tally.scores`.
Photons and Charged Particles
-----------------------------
In OpenMC, energy deposition from photons or charged particles is scored using
the energy balance method based on Equation :eq:`energy-balance-photon`. Special
consideration is given to electrons and positrons as described below.
+++++++++++++++++
Charged Particles
+++++++++++++++++
OpenMC tracks photons interaction by interaction so the energy deposited in each
collision is easily attributed back to the nuclide and reaction for which the
photon interacted with. Charged particles (electrons and photons) aren't tracked
in the same way. For charged particles, OpenMC assumes that all their energy
(less the energy of bremsstrahlung radiation) is deposited in the material in
which they were born. In this way it is harder to trace how much energy should
be attributed in each nuclide.
According to the CSDA approximation (see :ref:`ttb`) the energy deposited by a
charged particle with kinetic energy :math:`T` in the :math:`i`-th element can
be calculated as:
.. math::
E_{i} = \int_{0}^{R(T)} w_{i}S_{\text{col,i}} dx
where :math:`R(T)` is the CSDA range of the charged particle,
:math:`S_{\text{col},i}` is the collision stopping power of the charged particle
in the :math:`i`-th element and :math:`w_i` is the mass fraction of the
:math:`i`-th element. According to the Bethe formula the collision stopping
power of the :math:`i`-th element is proportional to :math:`Z_i/A_i`, so the
fractional collision stopping power from the :math:`i`-th element is:
.. math::
\frac{w_{i}S_{\text{col},i}(T)}{S_{\text{col}}(T)} =
\frac{\frac{w_{i}Z_{i}}{A_{i}}}{\sum_{i}\frac{w_{i}Z_{i}}{A_{i}}} =
\frac{\gamma_i Z_{i}}{\sum_{i}\gamma_i Z_{i}}.
where :math:`\gamma_i` is the atomic fraction of the :math:`i`-th element.
Therefore, the energy deposited by charged particles should be attributed to
a given element according to its fractional charge density.
----------
References
----------

View file

@ -1066,5 +1066,5 @@ 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: https://mcnp.lanl.gov
.. _Serpent: http://montecarlo.vtt.fi
.. _Serpent: https://serpent.vtt.fi
.. _Monte Carlo Performance benchmark: https://github.com/mit-crpg/benchmarks/tree/master/mc-performance/openmc

View file

@ -14,9 +14,12 @@ Theory and Methodology
random_numbers
neutron_physics
photon_physics
charged_particles_physics
tallies
eigenvalue
depletion
energy_deposition
parallelization
cmfd
variance_reduction
random_ray

View file

@ -45,7 +45,7 @@ following steps:
- Initialize the pseudorandom number generator.
- Read the contiuous-energy or multi-group cross section data specified in
- Read the continuous-energy or multi-group cross section data specified in
the problem.
- If using a special energy grid treatment such as a union energy grid or

View file

@ -91,7 +91,7 @@ inelastic scattering reactions. The specific multi-group scattering
implementation is discussed in the :ref:`multi-group-scatter` section.
Elastic scattering refers to the process by which a neutron scatters off a
nucleus and does not leave it in an excited. It is referred to as "elastic"
nucleus and does not leave it in an excited state. It is referred to as "elastic"
because in the center-of-mass system, the neutron does not actually lose
energy. However, in lab coordinates, the neutron does indeed lose
energy. Elastic scattering can be treated exactly in a Monte Carlo code thanks
@ -182,7 +182,7 @@ Inelastic Scattering
--------------------
Note that the multi-group mode makes no distinction between elastic or
inelastic scattering reactions. The spceific multi-group scattering
inelastic scattering reactions. The specific multi-group scattering
implementation is discussed in the :ref:`multi-group-scatter` section.
The major algorithms for inelastic scattering were described in previous
@ -290,7 +290,10 @@ create and store fission sites for the following generation. First, the average
number of prompt and delayed neutrons must be determined to decide whether the
secondary neutrons will be prompt or delayed. This is important because delayed
neutrons have a markedly different spectrum from prompt neutrons, one that has a
lower average energy of emission. The total number of neutrons emitted
lower average energy of emission. Furthermore, in simulations where tracking
time of neutrons is important, we need to consider the emission time delay of
the secondary neutrons, which is dependent on the decay constant of the
delayed neutron precursor. The total number of neutrons emitted
:math:`\nu_t` is given as a function of incident energy in the ENDF format. Two
representations exist for :math:`\nu_t`. The first is a polynomial of order
:math:`N` with coefficients :math:`c_0,c_1,\dots,c_N`. If :math:`\nu_t` has this
@ -306,8 +309,8 @@ interpolation law. The number of prompt neutrons released per fission event
:math:`\nu_p` is also given as a function of incident energy and can be
specified in a polynomial or tabular format. The number of delayed neutrons
released per fission event :math:`\nu_d` can only be specified in a tabular
format. In practice, we only need to determine :math:`nu_t` and
:math:`nu_d`. Once these have been determined, we can calculated the delayed
format. In practice, we only need to determine :math:`\nu_t` and
:math:`\nu_d`. Once these have been determined, we can calculate the delayed
neutron fraction
.. math::
@ -335,8 +338,14 @@ neutrons. Otherwise, we produce :math:`\lfloor \nu \rfloor + 1` neutrons. Then,
for each fission site produced, we sample the outgoing angle and energy
according to the algorithms given in :ref:`sample-angle` and
:ref:`sample-energy` respectively. If the neutron is to be born delayed, then
there is an extra step of sampling a delayed neutron precursor group since they
each have an associated secondary energy distribution.
there is an extra step of sampling a delayed neutron precursor group to get the
associated secondary energy distribution and the decay constant
:math:`\lambda`, which is needed to sample the emission delay time :math:`t_d`:
.. math::
:label: sample-delay-time
t_d = -\frac{\ln \xi}{\lambda}.
The sampled outgoing angle and energy of fission neutrons along with the
position of the collision site are stored in an array called the fission
@ -359,7 +368,7 @@ 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 <endf102>`_ specifies a
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
correlated energy-angle distributions. The ACE format specifies its own
@ -1403,7 +1412,7 @@ given analytically by
.. math::
:label: coherent-elastic-angle
\mu = 1 - \frac{E_i}{E}
\mu = 1 - \frac{2E_i}{E}
where :math:`E_i` is the energy of the Bragg edge that scattered the neutron.
@ -1416,8 +1425,7 @@ 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>`_:
scattering can be sampled by inverting equation 7.4 from the `ENDF-6 Format`_:
.. math::
:label: incoherent-elastic-mu-exact
@ -1744,19 +1752,19 @@ types.
.. _Watt fission spectrum: https://doi.org/10.1103/PhysRev.87.1037
.. _Foderaro: http://hdl.handle.net/1721.1/1716
.. _Foderaro: https://dspace.mit.edu/handle/1721.1/1716
.. _OECD: https://www.oecd-nea.org/tools/abstract/detail/NEA-1792
.. _NJOY: https://www.njoy21.io/NJOY2016/
.. _PREPRO: https://www-nds.iaea.org/ndspub/endf/prepro/
.. _PREPRO: https://www-nds.iaea.org/public/endf/prepro/
.. _endf102: https://www.oecd-nea.org/dbdata/data/manual-endf/endf102.pdf
.. _ENDF-6 Format: https://www.oecd-nea.org/dbdata/data/manual-endf/endf102.pdf
.. _Monte Carlo Sampler: https://permalink.lanl.gov/object/tr?what=info:lanl-repo/lareport/LA-09721-MS
.. _Monte Carlo Sampler: https://mcnp.lanl.gov/pdf_files/TechReport_1983_LANL_LA-9721-MS_EverettCashwell.pdf
.. _LA-UR-14-27694: https://permalink.lanl.gov/object/tr?what=info:lanl-repo/lareport/LA-UR-14-27694
.. _LA-UR-14-27694: https://www.osti.gov/biblio/1159204
.. _MC21: https://www.osti.gov/biblio/903083
@ -1764,6 +1772,4 @@ types.
.. _Sutton and Brown: https://www.osti.gov/biblio/307911
.. _lectures: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-05-4983.pdf
.. _MCNP Manual: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-03-1987.pdf
.. _lectures: https://mcnp.lanl.gov/pdf_files/TechReport_2005_LANL_LA-UR-05-4983_Brown.pdf

View file

@ -293,7 +293,7 @@ Cost of Nearest Neighbor Algorithm
----------------------------------
With the communication cost of the traditional fission bank algorithm
quantified, we now proceed to discuss the communicatin cost of the proposed
quantified, we now proceed to discuss the communication cost of the proposed
algorithm. Comparing the cost of communication of this algorithm with the
traditional algorithm is not trivial due to fact that the cost will be a
function of how many fission sites are sampled on each node. If each node
@ -398,7 +398,7 @@ equation :eq:`k-to-source`, we can relate the stochastic eigenvalue to the
integral of the noise component of the source distribution as
.. math::
:label: noise-integeral
:label: noise-integral
N\hat{k} = Nk + \sqrt{N} \int \hat{\epsilon}(\mathbf{r}) \: d\mathbf{r}.
@ -609,17 +609,17 @@ is actually independent of the number of nodes:
.. _first paper: https://doi.org/10.2307/2280232
.. _work of Forrest Brown: http://hdl.handle.net/2027.42/24996
.. _work of Forrest Brown: https://deepblue.lib.umich.edu/handle/2027.42/24996
.. _Brissenden and Garlick: https://doi.org/10.1016/0306-4549(86)90095-2
.. _MPICH: http://www.mpich.org
.. _MPICH: https://www.mpich.org
.. _binomial tree: https://www.mcs.anl.gov/~thakur/papers/ijhpca-coll.pdf
.. _Geary: https://doi.org/10.2307/2342070
.. _Barnett: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.51.7772
.. _Barnett: https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.51.7772
.. _single-instruction multiple-data: https://en.wikipedia.org/wiki/SIMD

View file

@ -667,342 +667,6 @@ and Auger electrons:
5. Repeat from step 1 for vacancy left by the transition electron.
Electron-Positron Annihilation
------------------------------
When a positron collides with an electron, both particles are annihilated and
generally two photons with equal energy are created. If the kinetic energy of
the positron is high enough, the two photons can have different energies, and
the higher-energy photon is emitted preferentially in the direction of flight
of the positron. It is also possible to produce a single photon if the
interaction occurs with a bound electron, and in some cases three (or, rarely,
even more) photons can be emitted. However, the annihilation cross section is
largest for low-energy positrons, and as the positron energy decreases, the
angular distribution of the emitted photons becomes isotropic.
In OpenMC, we assume the most likely case in which a low-energy positron (which
has already lost most of its energy to bremsstrahlung radiation) interacts with
an electron which is free and at rest. Two photons with energy equal to the
electron rest mass energy :math:`m_e c^2 = 0.511` MeV are emitted isotropically
in opposite directions.
Bremsstrahlung
--------------
When a charged particle is decelerated in the field of an atom, some of its
kinetic energy is converted into electromagnetic radiation known as
bremsstrahlung, or 'braking radiation'. In each event, an electron or positron
with kinetic energy :math:`T` generates a photon with an energy :math:`E`
between :math:`0` and :math:`T`. Bremsstrahlung is described by a cross section
that is differential in photon energy, in the direction of the emitted photon,
and in the final direction of the charged particle. However, in Monte Carlo
simulations it is typical to integrate over the angular variables to obtain a
single differential cross section with respect to photon energy, which is often
expressed in the form
.. math::
:label: bremsstrahlung-dcs
\frac{d\sigma_{\text{br}}}{dE} = \frac{Z^2}{\beta^2} \frac{1}{E}
\chi(Z, T, \kappa),
where :math:`\kappa = E/T` is the reduced photon energy and :math:`\chi(Z, T,
\kappa)` is the scaled bremsstrahlung cross section, which is experimentally
measured.
Because electrons are attracted to atomic nuclei whereas positrons are
repulsed, the cross section for positrons is smaller, though it approaches that
of electrons in the high energy limit. To obtain the positron cross section, we
multiply :eq:`bremsstrahlung-dcs` by the :math:`\kappa`-independent factor used
in Salvat_,
.. math::
:label: positron-factor
\begin{aligned}
F_{\text{p}}(Z,T) =
& 1 - \text{exp}(-1.2359\times 10^{-1}t + 6.1274\times 10^{-2}t^2 - 3.1516\times 10^{-2}t^3 \\
& + 7.7446\times 10^{-3}t^4 - 1.0595\times 10^{-3}t^5 + 7.0568\times 10^{-5}t^6 \\
& - 1.8080\times 10^{-6}t^7),
\end{aligned}
where
.. math::
:label: positron-factor-t
t = \ln\left(1 + \frac{10^6}{Z^2}\frac{T}{\text{m}_\text{e}c^2} \right).
:math:`F_{\text{p}}(Z,T)` is the ratio of the radiative stopping powers for
positrons and electrons. Stopping power describes the average energy loss per
unit path length of a charged particle as it passes through matter:
.. math::
:label: stopping-power
-\frac{dT}{ds} = n \int E \frac{d\sigma}{dE} dE \equiv S(T),
where :math:`n` is the number density of the material and :math:`d\sigma/dE` is
the cross section differential in energy loss. The total stopping power
:math:`S(T)` can be separated into two components: the radiative stopping
power :math:`S_{\text{rad}}(T)`, which refers to energy loss due to
bremsstrahlung, and the collision stopping power :math:`S_{\text{col}}(T)`,
which refers to the energy loss due to inelastic collisions with bound
electrons in the material that result in ionization and excitation. The
radiative stopping power for electrons is given by
.. math::
:label: radiative-stopping-power
S_{\text{rad}}(T) = n \frac{Z^2}{\beta^2} T \int_0^1 \chi(Z,T,\kappa)
d\kappa.
To obtain the radiative stopping power for positrons,
:eq:`radiative-stopping-power` is multiplied by :eq:`positron-factor`.
While the models for photon interactions with matter described above can safely
assume interactions occur with free atoms, sampling the target atom based on
the macroscopic cross sections, molecular effects cannot necessarily be
disregarded for charged particle treatment. For compounds and mixtures, the
bremsstrahlung cross section is calculated using Bragg's additivity rule as
.. math::
:label: material-bremsstrahlung-dcs
\frac{d\sigma_{\text{br}}}{dE} = \frac{1}{\beta^2 E} \sum_i \gamma_i Z^2_i
\chi(Z_i, T, \kappa),
where the sum is over the constituent elements and :math:`\gamma_i` is the
atomic fraction of the :math:`i`-th element. Similarly, the radiative stopping
power is calculated using Bragg's additivity rule as
.. math::
:label: material-radiative-stopping-power
S_{\text{rad}}(T) = \sum_i w_i S_{\text{rad},i}(T),
where :math:`w_i` is the mass fraction of the :math:`i`-th element and
:math:`S_{\text{rad},i}(T)` is found for element :math:`i` using
:eq:`radiative-stopping-power`. The collision stopping power, however, is a
function of certain quantities such as the mean excitation energy :math:`I` and
the density effect correction :math:`\delta_F` that depend on molecular
properties. These quantities cannot simply be summed over constituent elements
in a compound, but should instead be calculated for the material. The Bethe
formula can be used to find the collision stopping power of the material:
.. math::
:label: material-collision-stopping-power
S_{\text{col}}(T) = \frac{2 \pi r_e^2 m_e c^2}{\beta^2} N_A \frac{Z}{A_M}
[\ln(T^2/I^2) + \ln(1 + \tau/2) + F(\tau) - \delta_F(T)],
where :math:`N_A` is Avogadro's number, :math:`A_M` is the molar mass,
:math:`\tau = T/m_e`, and :math:`F(\tau)` depends on the particle type. For
electrons,
.. math::
:label: F-electron
F_{-}(\tau) = (1 - \beta^2)[1 + \tau^2/8 - (2\tau + 1) \ln2],
while for positrons
.. math::
:label: F-positron
F_{+}(\tau) = 2\ln2 - (\beta^2/12)[23 + 14/(\tau + 2) + 10/(\tau + 2)^2 +
4/(\tau + 2)^3].
The density effect correction :math:`\delta_F` takes into account the reduction
of the collision stopping power due to the polarization of the material the
charged particle is passing through by the electric field of the particle.
It can be evaluated using the method described by Sternheimer_, where the
equation for :math:`\delta_F` is
.. math::
:label: density-effect-correction
\delta_F(\beta) = \sum_{i=1}^n f_i \ln[(l_i^2 + l^2)/l_i^2] -
l^2(1-\beta^2).
Here, :math:`f_i` is the oscillator strength of the :math:`i`-th transition,
given by :math:`f_i = n_i/Z`, where :math:`n_i` is the number of electrons in
the :math:`i`-th subshell. The frequency :math:`l` is the solution of the
equation
.. math::
:label: density-effect-l
\frac{1}{\beta^2} - 1 = \sum_{i=1}^{n} \frac{f_i}{\bar{\nu}_i^2 + l^2},
where :math:`\bar{v}_i` is defined as
.. math::
:label: density-effect-nubar
\bar{\nu}_i = h\nu_i \rho / h\nu_p.
The plasma energy :math:`h\nu_p` of the medium is given by
.. math::
:label: plasma-frequency
h\nu_p = \sqrt{\frac{(hc)^2 r_e \rho_m N_A Z}{\pi A}},
where :math:`A` is the atomic weight and :math:`\rho_m` is the density of the
material. In :eq:`density-effect-nubar`, :math:`h\nu_i` is the oscillator
energy, and :math:`\rho` is an adjustment factor introduced to give agreement
between the experimental values of the oscillator energies and the mean
excitation energy. The :math:`l_i` in :eq:`density-effect-correction` are
defined as
.. math::
:label: density-effect-li
\begin{aligned}
l_i &= (\bar{\nu}_i^2 + 2/3f_i)^{1/2} ~~~~&\text{for}~~ \bar{\nu}_i > 0 \\
l_n &= f_n^{1/2} ~~~~&\text{for}~~ \bar{\nu}_n = 0,
\end{aligned}
where the second case applies to conduction electrons. For a conductor,
:math:`f_n` is given by :math:`n_c/Z`, where :math:`n_c` is the effective
number of conduction electrons, and :math:`v_n = 0`. The adjustment factor
:math:`\rho` is determined using the equation for the mean excitation energy:
.. math::
:label: mean-excitation-energy
\ln I = \sum_{i=1}^{n-1} f_i \ln[(h\nu_i\rho)^2 + 2/3f_i(h\nu_p)^2]^{1/2} +
f_n \ln (h\nu_pf_n^{1/2}).
.. _ttb:
Thick-Target Bremsstrahlung Approximation
+++++++++++++++++++++++++++++++++++++++++
Since charged particles lose their energy on a much shorter distance scale than
neutral particles, not much error should be introduced by neglecting to
transport electrons. However, the bremsstrahlung emitted from high energy
electrons and positrons can travel far from the interaction site. Thus, even
without a full electron transport mode it is necessary to model bremsstrahlung.
We use a thick-target bremsstrahlung (TTB) approximation based on the models in
Salvat_ and Kaltiaisenaho_ for generating bremsstrahlung photons, which assumes
the charged particle loses all its energy in a single homogeneous material
region.
To model bremsstrahlung using the TTB approximation, we need to know the number
of photons emitted by the charged particle and the energy distribution of the
photons. These quantities can be calculated using the continuous slowing down
approximation (CSDA). The CSDA assumes charged particles lose energy
continuously along their trajectory with a rate of energy loss equal to the
total stopping power, ignoring fluctuations in the energy loss. The
approximation is useful for expressing average quantities that describe how
charged particles slow down in matter. For example, the CSDA range approximates
the average path length a charged particle travels as it slows to rest:
.. math::
:label: csda-range
R(T) = \int^T_0 \frac{dT'}{S(T')}.
Actual path lengths will fluctuate around :math:`R(T)`. The average number of
photons emitted per unit path length is given by the inverse bremsstrahlung
mean free path:
.. math::
:label: inverse-bremsstrahlung-mfp
\lambda_{\text{br}}^{-1}(T,E_{\text{cut}})
= n\int_{E_{\text{cut}}}^T\frac{d\sigma_{\text{br}}}{dE}dE
= n\frac{Z^2}{\beta^2}\int_{\kappa_{\text{cut}}}^1\frac{1}{\kappa}
\chi(Z,T,\kappa)d\kappa.
The lower limit of the integral in :eq:`inverse-bremsstrahlung-mfp` is non-zero
because the bremsstrahlung differential cross section diverges for small photon
energies but is finite for photon energies above some cutoff energy
:math:`E_{\text{cut}}`. The mean free path
:math:`\lambda_{\text{br}}^{-1}(T,E_{\text{cut}})` is used to calculate the
photon number yield, defined as the average number of photons emitted with
energy greater than :math:`E_{\text{cut}}` as the charged particle slows down
from energy :math:`T` to :math:`E_{\text{cut}}`. The photon number yield is
given by
.. math::
:label: photon-number-yield
Y(T,E_{\text{cut}}) = \int^{R(T)}_{R(E_{\text{cut}})}
\lambda_{\text{br}}^{-1}(T',E_{\text{cut}})ds = \int_{E_{\text{cut}}}^T
\frac{\lambda_{\text{br}}^{-1}(T',E_{\text{cut}})}{S(T')}dT'.
:math:`Y(T,E_{\text{cut}})` can be used to construct the energy spectrum of
bremsstrahlung photons: the number of photons created with energy between
:math:`E_1` and :math:`E_2` by a charged particle with initial kinetic energy
:math:`T` as it comes to rest is given by :math:`Y(T,E_1) - Y(T,E_2)`.
To simulate the emission of bremsstrahlung photons, the total stopping power
and bremsstrahlung differential cross section for positrons and electrons must
be calculated for a given material using :eq:`material-bremsstrahlung-dcs` and
:eq:`material-radiative-stopping-power`. These quantities are used to build the
tabulated bremsstrahlung energy PDF and CDF for that material for each incident
energy :math:`T_k` on the energy grid. The following algorithm is then applied
to sample the photon energies:
1. For an incident charged particle with energy :math:`T`, sample the number of
emitted photons as
.. math::
N = \lfloor Y(T,E_{\text{cut}}) + \xi_1 \rfloor.
2. Rather than interpolate the PDF between indices :math:`k` and :math:`k+1`
for which :math:`T_k < T < T_{k+1}`, which is computationally expensive, use
the composition method and sample from the PDF at either :math:`k` or
:math:`k+1`. Using linear interpolation on a logarithmic scale, the PDF can
be expressed as
.. math::
p_{\text{br}}(T,E) = \pi_k p_{\text{br}}(T_k,E) + \pi_{k+1}
p_{\text{br}}(T_{k+1},E),
where the interpolation weights are
.. math::
\pi_k = \frac{\ln T_{k+1} - \ln T}{\ln T_{k+1} - \ln T_k},~~~
\pi_{k+1} = \frac{\ln T - \ln T_k}{\ln T_{k+1} - \ln T_k}.
Sample either the index :math:`i = k` or :math:`i = k+1` according to the
point probabilities :math:`\pi_{k}` and :math:`\pi_{k+1}`.
3. Determine the maximum value of the CDF :math:`P_{\text{br,max}}`.
3. Sample the photon energies using the inverse transform method with the
tabulated CDF :math:`P_{\text{br}}(T_i, E)` i.e.,
.. math::
E = E_j \left[ (1 + a_j) \frac{\xi_2 P_{\text{br,max}} -
P_{\text{br}}(T_i, E_j)} {E_j p_{\text{br}}(T_i, E_j)} + 1
\right]^{\frac{1}{1 + a_j}}
where the interpolation factor :math:`a_j` is given by
.. math::
a_j = \frac{\ln p_{\text{br}}(T_i,E_{j+1}) - \ln p_{\text{br}}(T_i,E_j)}
{\ln E_{j+1} - \ln E_j}
and :math:`P_{\text{br}}(T_i, E_j) \le \xi_2 P_{\text{br,max}} \le
P_{\text{br}}(T_i, E_{j+1})`.
We ignore the range of the electron or positron, i.e., the bremsstrahlung
photons are produced in the same location that the charged particle was
created. The direction of the photons is assumed to be the same as the
direction of the incident charged particle, which is a reasonable approximation
at higher energies when the bremsstrahlung radiation is emitted at small
angles.
.. _photon_production:
@ -1059,16 +723,14 @@ emitted photon.
.. _anomalous scattering: http://pd.chem.ucl.ac.uk/pdnn/diff1/anomscat.htm
.. _Kahn's rejection method: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/aecu-3259_kahn.pdf
.. _Kahn's rejection method: https://doi.org/10.2172/4353680
.. _Klein-Nishina: https://en.wikipedia.org/wiki/Klein%E2%80%93Nishina_formula
.. _LA-UR-04-0487: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-04-0487.pdf
.. _LA-UR-04-0487: https://mcnp.lanl.gov/pdf_files/TechReport_2004_LANL_LA-UR-04-0487_Sood.pdf
.. _LA-UR-04-0488: https://laws.lanl.gov/vhosts/mcnp.lanl.gov/pdf_files/la-ur-04-0488.pdf
.. _LA-UR-04-0488: https://mcnp.lanl.gov/pdf_files/TechReport_2004_LANL_LA-UR-04-0488_SoodWhite.pdf
.. _Kaltiaisenaho: https://aaltodoc.aalto.fi/bitstream/handle/123456789/21004/master_Kaltiaisenaho_Toni_2016.pdf
.. _Salvat: https://www.oecd-nea.org/globalsearch/download.php?doc=77434
.. _Sternheimer: https://doi.org/10.1103/PhysRevB.26.6067
.. _Salvat: https://doi.org/10.1787/32da5043-en

View file

@ -7,7 +7,7 @@ Random Number Generation
In order to sample probability distributions, one must be able to produce random
numbers. The standard technique to do this is to generate numbers on the
interval :math:`[0,1)` from a deterministic sequence that has properties that
make it appear to be random, e.g. being uniformly distributed and not exhibiting
make it appear to be random, e.g., being uniformly distributed and not exhibiting
correlation between successive terms. Since the numbers produced this way are
not truly "random" in a strict sense, they are typically referred to as
pseudorandom numbers, and the techniques used to generate them are pseudorandom
@ -15,6 +15,11 @@ number generators (PRNGs). Numbers sampled on the unit interval can then be
transformed for the purpose of sampling other continuous or discrete probability
distributions.
There are many different algorithms for pseudorandom number generation. OpenMC
currently uses `permuted congruential generator`_ (PCG), which builds on top of
the simpler linear congruential generator (LCG). Both algorithms are described
below.
------------------------------
Linear Congruential Generators
------------------------------
@ -37,8 +42,8 @@ be generated with a method chosen at random. Some theory should be used."
Typically, :math:`M` is chosen to be a power of two as this enables :math:`x
\mod M` to be performed using the bitwise AND operator with a bit mask. The
constants for the linear congruential generator used by default in OpenMC are
:math:`g = 2806196910506780709`, :math:`c = 1`, and :math:`M = 2^{63}` (see
`L'Ecuyer`_).
:math:`g = 2806196910506780709`, :math:`c = 1`, and :math:`M = 2^{63}` (from
`L'Ecuyer <https://doi.org/10.1090/S0025-5718-99-00996-5>`_).
Skip-ahead Capability
---------------------
@ -50,7 +55,8 @@ want to skip ahead :math:`N` random numbers and :math:`N` is large, the cost of
sampling :math:`N` random numbers to get to that position may be prohibitively
expensive. Fortunately, algorithms have been developed that allow us to skip
ahead in :math:`O(\log_2 N)` operations instead of :math:`O(N)`. One algorithm
to do so is described in a paper by Brown_. This algorithm relies on the following
to do so is described in a `paper by Brown
<https://www.osti.gov/biblio/976209>`_. This algorithm relies on the following
relationship:
.. math::
@ -58,15 +64,26 @@ relationship:
\xi_{i+k} = g^k \xi_i + c \frac{g^k - 1}{g - 1} \mod M
Note that equation :eq:`lcg-skipahead` has the same general form as equation :eq:`lcg`, so
the idea is to determine the new multiplicative and additive constants in
:math:`O(\log_2 N)` operations.
.. only:: html
.. rubric:: References
Note that equation :eq:`lcg-skipahead` has the same general form as equation
:eq:`lcg`, so the idea is to determine the new multiplicative and additive
constants in :math:`O(\log_2 N)` operations.
.. _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
--------------------------------
Permuted Congruential Generators
--------------------------------
The `permuted congruential generator`_ (PCG) algorithm aims to improve upon the
LCG algorithm by permuting the output. The algorithm works on the basic
principle of first advancing the generator state using the LCG algorithm and
then applying a permutation function on the LCG state to obtain the output. This
results in increased statistical quality as measured by common statistical tests
while exhibiting a very small performance overhead relative to the LCG algorithm
and an equivalent memory footprint. For further details, see the original
technical report by `O'Neill
<https://www.pcg-random.org/pdf/hmc-cs-2014-0905.pdf>`_. OpenMC uses the
PCG-RXS-M-XS variant with a 64-bit state and 64-bit output.
.. _linear congruential generator: https://en.wikipedia.org/wiki/Linear_congruential_generator
.. _permuted congruential generator: https://en.wikipedia.org/wiki/Permuted_congruential_generator

File diff suppressed because it is too large Load diff

View file

@ -4,9 +4,9 @@
Tallies
=======
Note that the methods discussed in this section are written specifically for
continuous-energy mode but equivalent apply to the multi-group mode if the
particle's energy is replaced with the particle's group
The methods discussed in this section are written specifically for continuous-
energy mode. However, they can also apply to the multi-group mode if the
particle's energy is instead interpreted as the particle's group.
------------------
Filters and Scores
@ -179,12 +179,12 @@ n(\mathbf{r}, \mathbf{\hat{\Omega}}, E, t)` and :math:`d\ell = v \, dt` where
Equation :eq:`track-length-integral` indicates that we can use the length of a
particle's trajectory as an estimate for the flux, i.e. the track-length
estimator of the flux would be
estimator of the volume-integrated flux would be
.. math::
:label: track-length-flux
\phi = \frac{1}{W} \sum_{i \in T} w_i \ell_i
V \phi = \frac{1}{W} \sum_{i \in T} w_i \ell_i
where :math:`T` is the set of all the particle's trajectories within the desired
volume and :math:`\ell_i` is the length of the :math:`i`-th trajectory. In the
@ -207,6 +207,8 @@ the change-in-angle), we must use an analog estimator.
.. TODO: Add description of surface current tallies
.. _tallies_statistics:
----------
Statistics
----------
@ -268,6 +270,14 @@ normal, log-normal, Weibull, etc. The central limit theorem states that as
Estimating Statistics of a Random Variable
------------------------------------------
After running OpenMC, each tallied quantity has a reported mean and standard
deviation. The below sections explain how these quantities are computed. Note
that OpenMC uses **batch statistics**, meaning that each observation for a tally
random variable corresponds to the aggregation of tally contributions from
multiple source particles that are grouped together into a single batch. See
:ref:`usersguide_particles` for more information on how the number of source
particles and statistical batches are specified.
Mean
++++
@ -377,6 +387,33 @@ of this is that the longer you run a simulation, the better you know your
results. Therefore, by running a simulation long enough, it is possible to
reduce the stochastic uncertainty to arbitrarily low levels.
Figure of Merit
+++++++++++++++
The figure of merit (FOM) is an indicator that accounts for both the statistical
uncertainty and the execution time and represents how much information is
obtained per unit time in the simulation. The FOM is defined as
.. math::
:label: figure_of_merit
FOM = \frac{1}{r^2 t},
where :math:`t` is the total execution time and :math:`r` is the relative error
defined as
.. math::
:label: relative_error
r = \frac{s_\bar{X}}{\bar{x}}.
Based on this definition, one can see that a higher FOM is desirable. The FOM is
useful as a comparative tool. For example, if a variance reduction technique is
being applied to a simulation, the FOM with variance reduction can be compared
to the FOM without variance reduction to ascertain whether the reduction in
variance outweighs the potential increase in execution time (e.g., due to
particle splitting).
Confidence Intervals
++++++++++++++++++++
@ -510,6 +547,6 @@ improve the estimate of the percentile.
.. _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/
.. _unpublished rational approximation: https://stackedboxes.org/2017/05/01/acklams-normal-quantile-function/
.. _MC21: http://www.osti.gov/bridge/servlets/purl/903083-HT5p1o/903083.pdf
.. _MC21: https://www.osti.gov/servlets/purl/903083

View file

@ -0,0 +1,134 @@
.. _methods_variance_reduction:
==================
Variance Reduction
==================
.. _methods_variance_reduction_intro:
------------
Introduction
------------
Transport problems can sometimes involve a significant degree of attenuation
between the source and a detector (tally) region, which can result in a flux
differential of ten orders of magnitude (or more) throughout the simulation
domain. As Monte Carlo uncertainties tend to be inversely proportional to the
physical flux density, it can be extremely difficult to accurately resolve
tallies in locations that are optically far from the source. This issue is
particularly common in fixed source simulations, where some tally locations may
not experience a single scoring event, even after billions of analog histories.
Variance reduction techniques aim to either flatten the global uncertainty
distribution, such that all regions of phase space have a fairly similar
uncertainty, or to reduce the uncertainty in specific locations (such as a
detector). There are two strategies available in OpenMC for variance reduction:
the Monte Carlo MAGIC method and the FW-CADIS method. Both strategies work by
developing a weight window mesh that can be utilized by subsequent Monte Carlo
solves to split particles heading towards areas of lower flux densities while
terminating particles in higher flux regions---all while maintaining a fair
game.
------------
MAGIC Method
------------
The Method of Automatic Generation of Importances by Calculation, or `MAGIC
method <https://doi.org/10.1016/j.fusengdes.2011.01.059>`_, is an iterative
technique that uses spatial flux information :math:`\phi(r)` obtained from a
normal Monte Carlo solve to produce weight windows :math:`w(r)` that can be
utilized by a subsequent iteration of Monte Carlo. While the first generation of
weight windows produced may only help to reduce variance slightly, use of these
weights to generate another set of weight windows results in a progressively
improving iterative scheme.
Equation :eq:`magic` defines how the lower bound of weight windows
:math:`w_{\ell}(r)` are generated with MAGIC using forward flux information.
Here, we can see that the flux at location :math:`r` is normalized by the
maximum flux in any group at that location. We can also see that the weights are
divided by a factor of two, which accounts for the typical :math:`5\times`
factor separating the lower and upper weight window bounds in OpenMC.
.. math::
:label: magic
w_{\ell}(r) = \frac{\phi(r)}{2\,\text{max}(\phi(r))}
A major advantage of this technique is that it does not require any special
transport machinery; it simply uses multiple Monte Carlo simulations to
iteratively improve a set of weight windows (which are typically defined on a
mesh covering the simulation domain). The downside to this method is that as the
flux differential increases between areas near and far from the source, it
requires more outer Monte Carlo iterations, each of which can be expensive in
itself. Additionally, computation of weight windows based on regular (forward)
neutron flux tally information does not produce the most numerically effective
set of weight windows. Nonetheless, MAGIC remains a simple and effective
technique for generating weight windows.
--------
FW-CADIS
--------
As discussed in the previous section, computation of weight windows based on
regular (forward) neutron flux tally information does not produce the most
numerically efficient set of weight windows. It is highly preferable to generate
weight windows based on spatial adjoint flux :math:`\phi^{\dag}(r)`
information. The adjoint flux is essentially the "reverse" simulation problem,
where we sample a random point and assume this is where a particle was absorbed,
and then trace it backwards (upscattering in energy), until we sample the point
where it was born from.
The Forward-Weighted Consistent Adjoint Driven Importance Sampling method, or
`FW-CADIS method <https://doi.org/10.13182/NSE12-33>`_, produces weight windows
for global variance reduction given adjoint flux information throughout the
entire domain. The weight window lower bound is defined in Equation
:eq:`fw_cadis`, and also involves a normalization step not shown here.
.. math::
:label: fw_cadis
w_{\ell}(r) = \frac{1}{2\phi^{\dag}(r)}
While the algorithm itself is quite simple, it requires estimates of the global
adjoint flux distribution, which is difficult to generate directly with Monte
Carlo transport. Thus, FW-CADIS typically uses an alternative solver (often
deterministic) that can be more readily adapted for generating adjoint flux
information, and which is often much cheaper than Monte Carlo given that a rough
solution is often sufficient for weight window generation.
The FW-CADIS implementation in OpenMC utilizes its own internal random ray
multigroup transport solver to generate the adjoint source distribution. No
coupling to any external transport is solver is necessary. The random ray solver
operates on the same geometry as the Monte Carlo solver, so no redefinition of
the simulation geometry is required. More details on how the adjoint flux is
computed are given in the :ref:`adjoint methods section <adjoint>`.
More information on the workflow is available in the :ref:`user guide
<variance_reduction>`, but generally production of weight windows with FW-CADIS
involves several stages (some of which are highly automated). These tasks
include generation of approximate multigroup cross section data for use by the
random ray solver, running of the random ray solver in normal (forward flux)
mode to generate a source for the adjoint solver, running of the random ray
solver in adjoint mode to generate adjoint flux tallies, and finally the
production of weight windows via the FW-CADIS method. As is discussed in the
user guide, most of these steps are automated together, making the additional
burden on the user fairly small.
The major advantage of this technique is that it typically produces much more
numerically efficient weight windows as compared to those generated with MAGIC,
sometimes with an order-of-magnitude improvement in the figure of merit
(Equation :eq:`variance_fom`), which accounts for both the variance and the
execution time. Another major advantage is that the cost of the random ray
solver is typically negligible compared to the cost of the subsequent Monte
Carlo solve itself, making it a very cheap method to deploy. The downside to
this method is that it introduces a second transport method into the mix (random
ray), such that there are more free input parameters for the user to know about
and adjust, potentially making the method more complex to use. However, as many
of the parameters have natural choices, much of this parameterization can be
handled automatically behind the scenes without the need for the user to be
aware of this.
.. math::
:label: variance_fom
\text{FOM} = \frac{1}{\text{Time} \times \sigma^2}

View file

@ -138,8 +138,8 @@ Geometry and Visualization
*Trans. Am. Nucl. Soc.*, **114**, 391-394 (2016).
- Derek M. Lax, "`Memory efficient indexing algorithm for physical properties in
OpenMC <http://hdl.handle.net/1721.1/97862>`_," S. M. Thesis, Massachusetts
Institute of Technology (2015).
OpenMC <https://dspace.mit.edu/handle/1721.1/97862>`_," S. M. Thesis,
Massachusetts Institute of Technology (2015).
- Derek Lax, William Boyd, Nicholas Horelik, Benoit Forget, and Kord Smith, "A
memory efficient algorithm for classifying unique regions in constructive
@ -399,7 +399,8 @@ Doppler Broadening
- Jonathan A. Walsh, Benoit Forget, Kord S. Smith, Brian C. Kiedrowski, and
Forrest B. Brown, "`Direct, on-the-fly calculation of unresolved resonance
region cross sections in Monte Carlo simulations
<http://hdl.handle.net/1721.1/108644>`_," *Proc. Joint Int. Conf. M&C+SNA+MC*,
<https://dspace.mit.edu/handle/1721.1/108644>`_," *Proc. Joint Int. Conf.
M&C+SNA+MC*,
Nashville, Tennessee, Apr. 19--23 (2015).
- Colin Josey, Benoit Forget, and Kord Smith, "`Windowed multipole sensitivity
@ -596,7 +597,8 @@ Depletion
- Matthew S. Ellis, Colin Josey, Benoit Forget, and Kord Smith, "`Spatially
Continuous Depletion Algorithm for Monte Carlo Simulations
<http://hdl.handle.net/1721.1/107880>`_," *Trans. Am. Nucl. Soc.*, **115**,
<https://dspace.mit.edu/handle/1721.1/107880>`_," *Trans. Am. Nucl. Soc.*,
**115**,
1221-1224 (2016).
- Anas Gul, K. S. Chaudri, R. Khan, and M. Azeen, "`Development and verification

View file

@ -21,19 +21,21 @@ Simulation Settings
:nosignatures:
:template: myclass.rst
openmc.Source
openmc.SourceBase
openmc.IndependentSource
openmc.FileSource
openmc.CompiledSource
openmc.MeshSource
openmc.SourceParticle
openmc.VolumeCalculation
openmc.WeightWindows
openmc.Settings
The following function can be used for generating a source file:
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.read_source_file
openmc.write_source_file
Material Specification
@ -44,9 +46,6 @@ Material Specification
:nosignatures:
:template: myclass.rst
openmc.Nuclide
openmc.Element
openmc.Macroscopic
openmc.Material
openmc.Materials
@ -88,6 +87,7 @@ Building geometry
openmc.Intersection
openmc.Union
openmc.Complement
openmc.BoundingBox
openmc.Cell
openmc.Universe
openmc.DAGMCUniverse
@ -119,17 +119,21 @@ Constructing Tallies
openmc.Filter
openmc.UniverseFilter
openmc.MaterialFilter
openmc.MaterialFromFilter
openmc.CellFilter
openmc.CellFromFilter
openmc.CellbornFilter
openmc.CellBornFilter
openmc.CellInstanceFilter
openmc.CollisionFilter
openmc.SurfaceFilter
openmc.MeshFilter
openmc.MeshBornFilter
openmc.MeshMaterialFilter
openmc.MeshSurfaceFilter
openmc.EnergyFilter
openmc.EnergyoutFilter
openmc.MuFilter
openmc.MuSurfaceFilter
openmc.PolarFilter
openmc.AzimuthalFilter
openmc.DistribcellFilter
@ -139,18 +143,30 @@ Constructing Tallies
openmc.SpatialLegendreFilter
openmc.SphericalHarmonicsFilter
openmc.TimeFilter
openmc.WeightFilter
openmc.ZernikeFilter
openmc.ZernikeRadialFilter
openmc.ParentNuclideFilter
openmc.ParticleFilter
openmc.MeshMaterialVolumes
openmc.Trigger
openmc.TallyDerivative
openmc.Tally
openmc.Tallies
Meshes
------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclassinherit.rst
openmc.RegularMesh
openmc.RectilinearMesh
openmc.CylindricalMesh
openmc.SphericalMesh
openmc.UnstructuredMesh
openmc.Trigger
openmc.TallyDerivative
openmc.Tally
openmc.Tallies
Geometry Plotting
-----------------
@ -161,6 +177,8 @@ Geometry Plotting
:template: myclass.rst
openmc.Plot
openmc.WireframeRayTracePlot
openmc.SolidRayTracePlot
openmc.Plots
Running OpenMC
@ -186,8 +204,19 @@ Post-processing
:template: myclass.rst
openmc.Particle
openmc.ParticleList
openmc.ParticleTrack
openmc.StatePoint
openmc.Summary
openmc.Track
openmc.Tracks
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.voxel_to_vtk
The following classes and functions are used for functional expansion reconstruction.
@ -220,6 +249,27 @@ Various classes may be created when performing tally slicing and/or arithmetic:
openmc.arithmetic.AggregateNuclide
openmc.arithmetic.AggregateFilter
Variance Reduction
------------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass
openmc.WeightWindows
openmc.WeightWindowsList
openmc.WeightWindowGenerator
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.hdf5_to_wws
openmc.wwinp_to_wws
Coarse Mesh Finite Difference Acceleration
------------------------------------------

View file

@ -13,25 +13,38 @@ Functions
:template: myfunction.rst
calculate_volumes
current_batch
export_properties
export_weight_windows
finalize
find_cell
find_material
dagmc_universe_cell_ids
global_bounding_box
global_tallies
hard_reset
id_map
import_properties
import_weight_windows
init
is_statepoint_batch
iter_batches
keff
load_nuclide
master
next_batch
num_realizations
plot_geometry
property_map
reset
reset_timers
run
run_in_memory
simulation_init
sample_external_source
simulation_finalize
simulation_init
source_bank
statepoint_load
statepoint_write
Classes
@ -42,12 +55,89 @@ Classes
:nosignatures:
:template: myclass.rst
AzimuthalFilter
Cell
CellFilter
CellInstanceFilter
CellbornFilter
CellfromFilter
CollisionFilter
CylindricalMesh
DelayedGroupFilter
DistribcellFilter
EnergyFilter
MaterialFilter
EnergyFunctionFilter
EnergyoutFilter
Filter
LegendreFilter
Material
MaterialFilter
MaterialFromFilter
Mesh
MeshFilter
MeshBornFilter
MeshSurfaceFilter
MuFilter
Nuclide
ParentNuclideFilter
ParticleFilter
PolarFilter
RectilinearMesh
RegularMesh
SpatialLegendreFilter
SphericalHarmonicsFilter
SphericalMesh
SurfaceFilter
Tally
TemporarySession
UniverseFilter
UnstructuredMesh
WeightFilter
WeightWindows
ZernikeFilter
ZernikeRadialFilter
Data
----
.. data:: cells
Mapping of cell ID to :class:`openmc.lib.Cell` instances.
:type: dict
.. data:: filters
Mapping of filter ID to :class:`openmc.lib.Filter` instances.
:type: dict
.. data:: materials
Mapping of material ID to :class:`openmc.lib.Material` instances.
:type: dict
.. data:: meshes
Mapping of mesh ID to :class:`openmc.lib.Mesh` instances.
:type: dict
.. data:: nuclides
Mapping of nuclide name to :class:`openmc.lib.Nuclide` instances.
:type: dict
.. data:: tallies
Mapping of tally ID to :class:`openmc.lib.Tally` instances.
:type: dict
.. data:: weight_windows
Mapping of weight window ID to :class:`openmc.lib.WeightWindows` instances.
:type: dict

View file

@ -61,9 +61,15 @@ Core Functions
atomic_mass
atomic_weight
combine_distributions
decay_constant
decay_energy
decay_photon_energy
dose_coefficients
gnd_name
gnds_name
half_life
isotopes
kalbach_slope
linearize
thin
water_density
@ -114,6 +120,7 @@ Angle-Energy Distributions
IncoherentElasticAE
IncoherentElasticAEDiscrete
IncoherentInelasticAEDiscrete
MixedElasticAE
Resonance Data
--------------

View file

@ -15,16 +15,18 @@ 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>`_.
The former is responsible for calculating 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:`CoupledOperator` class is provided to obtain reaction rates via tallies
through OpenMC's transport solver, and the :class:`IndependentOperator` class is
provided to obtain reaction rates from cross-section data. 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 <https://dspace.mit.edu/handle/1721.1/113721>`_.
.. autosummary::
:toctree: generated
@ -40,18 +42,30 @@ transport-depletion coupling algorithms <http://hdl.handle.net/1721.1/113721>`_.
SICELIIntegrator
SILEQIIntegrator
Each of these classes expects a "transport operator" to be passed. An operator
specific to OpenMC is available using the following class:
Each of these classes expects a "transport operator" to be passed. OpenMC
provides the following transport operator classes:
.. autosummary::
:toctree: generated
:nosignatures:
:template: mycallable.rst
Operator
CoupledOperator
IndependentOperator
The :class:`Operator` must also have some knowledge of how nuclides transmute
and decay. This is handled by the :class:`Chain`.
The :class:`CoupledOperator` and :class:`IndependentOperator` classes must also
have some knowledge of how nuclides transmute and decay. This is handled by the
:class:`Chain` class.
The :class:`IndependentOperator` class requires a set of fluxes and microscopic
cross sections. The following function can be used to generate this information:
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
get_microxs_and_flux
Minimal Example
---------------
@ -64,19 +78,18 @@ A minimal example for performing depletion would be:
>>> import openmc.deplete
>>> geometry = openmc.Geometry.from_xml()
>>> settings = openmc.Settings.from_xml()
>>> model = openmc.Model(geometry, settings)
# Representation of a depletion chain
>>> chain_file = "chain_casl.xml"
>>> operator = openmc.deplete.Operator(
... geometry, settings, chain_file)
>>> operator = openmc.deplete.CoupledOperator(model, 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 = openmc.deplete.CECMIntegrator(operator, dt, power)
>>> cecm.integrate()
Internal Classes and Functions
@ -131,10 +144,11 @@ data, such as number densities and reaction rates for each material.
:template: myclass.rst
AtomNumber
MicroXS
OperatorResult
ReactionRates
Results
ResultsList
StepResult
The following class and functions are used to solve the depletion equations,
with :func:`cram.CRAM48` being the default.
@ -166,7 +180,13 @@ with :func:`cram.CRAM48` being the default.
:type: bool
The following classes are used to help the :class:`openmc.deplete.Operator`
.. data:: pool.NUM_PROCESSES
Number of worker processes used for depletion calculations, which rely on the
:class:`multiprocessing.pool.Pool` class. If set to ``None`` (default), the
number returned by :func:`os.cpu_count` is used.
The following classes are used to help the :class:`openmc.deplete.CoupledOperator`
compute quantities like effective fission yields, reaction rates, and
total system energy.
@ -183,14 +203,56 @@ total system energy.
helpers.FissionYieldCutoffHelper
helpers.FluxCollapseHelper
The :class:`openmc.deplete.IndependentOperator` uses inner classes subclassed
from those listed above to perform similar calculations.
The following classes are used to define external source rates or transfer rates
to model continuous removal or feed of nuclides during depletion.
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
transfer_rates.ExternalSourceRates
transfer_rates.TransferRates
Intermediate Classes
--------------------
Specific implementations of abstract base classes may utilize some of
the same methods and data structures. These methods and data are stored
in intermediate classes.
Methods common to tally-based implementation of :class:`FissionYieldHelper`
are stored in :class:`helpers.TalliedFissionYieldHelper`
.. autosummary::
:toctree: generated
:nosignatures:
:template: myclass.rst
helpers.TalliedFissionYieldHelper
Methods common to OpenMC-specific implementations of :class:`TransportOperator`
are stored in :class:`openmc_operator.OpenMCOperator`
.. autosummary::
:toctree: generated
:nosignatures:
:template: mycallable.rst
openmc_operator.OpenMCOperator
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
schemes for collecting reaction rates and other data prior to depleting
materials
.. autosummary::
:toctree: generated
@ -200,7 +262,9 @@ prior to depleting materials
abc.TransportOperator
The following classes are abstract classes used to pass information from
OpenMC simulations back on to the :class:`abc.TransportOperator`
transport simulations (in the case of transport-coupled depletion) or to
simply calculate these quantities directly (in the case of
transport-independent depletion) back on to the :class:`abc.TransportOperator`
.. autosummary::
:toctree: generated
@ -210,7 +274,6 @@ OpenMC simulations back on to the :class:`abc.TransportOperator`
abc.NormalizationHelper
abc.FissionYieldHelper
abc.ReactionRateHelper
abc.TalliedFissionYieldHelper
Custom integrators or depletion solvers can be developed by subclassing from
the following abstract base classes:
@ -223,3 +286,15 @@ the following abstract base classes:
abc.Integrator
abc.SIIntegrator
abc.DepSystemSolver
D1S Functions
-------------
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
d1s.prepare_tallies
d1s.time_correction_factors
d1s.apply_time_correction

View file

@ -41,6 +41,7 @@ Multi-group Cross Sections
openmc.mgxs.KappaFissionXS
openmc.mgxs.MultiplicityMatrixXS
openmc.mgxs.NuFissionMatrixXS
openmc.mgxs.ReducedAbsorptionXS
openmc.mgxs.ScatterXS
openmc.mgxs.ScatterMatrixXS
openmc.mgxs.ScatterProbabilityMatrix

View file

@ -11,9 +11,6 @@ Convenience Functions
:template: myfunction.rst
openmc.model.borated_water
openmc.model.cylinder_from_points
openmc.model.hexagonal_prism
openmc.model.rectangular_prism
openmc.model.subdivide
openmc.model.pin
@ -25,8 +22,17 @@ Composite Surfaces
:nosignatures:
:template: myclass.rst
openmc.model.ConicalFrustum
openmc.model.CruciformPrism
openmc.model.CylinderSector
openmc.model.HexagonalPrism
openmc.model.IsogonalOctagon
openmc.model.OrthogonalBox
openmc.model.Polygon
openmc.model.RectangularParallelepiped
openmc.model.RectangularPrism
openmc.model.RightCircularCylinder
openmc.model.Vessel
openmc.model.XConeOneSided
openmc.model.YConeOneSided
openmc.model.ZConeOneSided

View file

@ -22,7 +22,14 @@ Univariate Probability Distributions
openmc.stats.Legendre
openmc.stats.Mixture
openmc.stats.Normal
openmc.stats.Muir
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.stats.delta_function
openmc.stats.muir
Angular Distributions
---------------------
@ -51,3 +58,12 @@ Spatial Distributions
openmc.stats.SphericalIndependent
openmc.stats.Box
openmc.stats.Point
openmc.stats.MeshSpatial
openmc.stats.PointCloud
.. autosummary::
:toctree: generated
:nosignatures:
:template: myfunction.rst
openmc.stats.spherical_uniform

View file

@ -8,40 +8,43 @@ This quick install guide outlines the basic steps needed to install OpenMC on
your computer. For more detailed instructions on configuring and installing
OpenMC, see :ref:`usersguide_install` in the User's Manual.
----------------------------------------
Installing on Linux/Mac with conda-forge
----------------------------------------
----------------------------------
Installing on Linux/Mac with Conda
----------------------------------
`Conda <https://conda.io/en/latest/>`_ is an open source package management
system and environment management system for installing multiple versions of
software packages and their dependencies and switching easily between them. If
you have `conda` installed on your system, OpenMC can be installed via the
`conda-forge` channel. First, add the `conda-forge` channel with:
`Conda <https://docs.conda.io/en/latest/>`_ is an open source package management
system and environments management system for installing multiple versions of
software packages and their dependencies and switching easily between them.
OpenMC can be installed in a `conda` environment. First, `conda` should be
`installed <https://www.anaconda.com/docs/getting-started/getting-started>`_
with either Anaconda Distribution or Miniconda. Once you have `conda` installed
on your system, OpenMC can be installed via the `conda-forge` channel.
First, add the `conda-forge` channel with:
.. code-block:: sh
conda config --add channels conda-forge
conda config --set channel_priority strict
To list the versions of OpenMC that are available on the `conda-forge` channel,
in your terminal window or an Anaconda Prompt run:
.. code-block:: sh
conda search openmc
OpenMC can then be installed with:
.. code-block:: sh
conda create -n openmc-env openmc
This will install OpenMC in a conda environment called `openmc-env`. To activate
the environment, run:
Then create and activate a new conda enviroment called `openmc-env` (or whatever
you wish) with OpenMC installed.
.. code-block:: sh
conda create --name openmc-env openmc
conda activate openmc-env
If you are installing on macOS with an Apple silicon ARM-based processor, you
will also need to specify the `--platform` option:
.. code-block:: sh
conda create --name openmc-env --platform osx-64 openmc
You are now in a conda environment called `openmc-env` that has OpenMC
installed.
-------------------------------------------
Installing on Linux/Mac/Windows with Docker
-------------------------------------------
@ -90,31 +93,53 @@ can be used to access the installed packages.
.. _Spack: https://spack.readthedocs.io/en/latest/
.. _setup guide: https://spack.readthedocs.io/en/latest/getting_started.html
--------------------------------
Installing from Source on Ubuntu
--------------------------------
-------------------------------
Manually Installing from Source
-------------------------------
To build OpenMC from source, several :ref:`prerequisites <prerequisites>` are
needed. If you are using Ubuntu or higher, all prerequisites can be installed
directly from the package manager:
Obtaining prerequisites on Ubuntu
---------------------------------
When building OpenMC from source, all :ref:`prerequisites <prerequisites>` can
be installed using the package manager:
.. code-block:: sh
sudo apt install g++ cmake libhdf5-dev libpng-dev
After the packages have been installed, follow the instructions below for
building and installing OpenMC from source.
After the packages have been installed, follow the instructions to build from
source below.
-------------------------------------------
Installing from Source on Linux or Mac OS X
-------------------------------------------
Obtaining prerequisites on macOS
--------------------------------
For an OpenMC build with multithreading enabled, a package manager like
`Homebrew <https://brew.sh>`_ should first be installed. Then, the following
packages should be installed, for example in Homebrew via:
.. code-block:: sh
brew install llvm cmake xtensor hdf5 python libomp libpng
The compiler provided by the above LLVM package should be used in place of the
one provisioned by XCode, which does not support the multithreading library used
by OpenMC. To ensure CMake picks up the correct compiler, make sure that either
the :envvar:`CXX` environment variable is set to the brew-installed ``clang++``
or that the directory containing it is on your :envvar:`PATH` environment
variable. Common locations for the brew-installed compiler are
``/opt/homebrew/opt/llvm/bin`` and ``/usr/local/opt/llvm/bin``.
After the packages have been installed, follow the instructions to build from
source below.
Building Source on Linux or macOS
---------------------------------
All OpenMC source code is hosted on `GitHub
<https://github.com/openmc-dev/openmc>`_. If you have `git
<https://git-scm.com>`_, the `gcc <https://gcc.gnu.org/>`_ compiler suite,
`CMake <https://cmake.org>`_, and `HDF5
<https://www.hdfgroup.org/solutions/hdf5/>`_ installed, you can download and
install OpenMC be entering the following commands in a terminal:
<https://git-scm.com>`_, a modern C++ compiler, `CMake <https://cmake.org>`_,
and `HDF5 <https://www.hdfgroup.org/solutions/hdf5/>`_ installed, you can
download and install OpenMC by entering the following commands in a terminal:
.. code-block:: sh
@ -134,14 +159,14 @@ should specify an installation directory where you have write access, e.g.
cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local ..
The :mod:`openmc` Python package must be installed separately. The easiest way
to install it is using `pip <https://pip.pypa.io/en/stable/>`_, which is
included by default in Python 3.4+. From the root directory of the OpenMC
distribution/repository, run:
to install it is using `pip <https://pip.pypa.io/en/stable/>`_.
From the root directory of the OpenMC repository, run:
.. code-block:: sh
pip install .
python -m pip install .
If you want to build a parallel version of OpenMC (using OpenMP or MPI),
directions can be found in the :ref:`detailed installation instructions
By default, OpenMC will be built with multithreading support. To build
distributed-memory parallel versions of OpenMC using MPI or to configure other
options, directions can be found in the :ref:`detailed installation instructions
<usersguide_build>`.

View file

@ -0,0 +1,182 @@
====================
What's New in 0.13.1
====================
.. currentmodule:: openmc
-------
Summary
-------
This release of OpenMC includes many bug fixes as well as improvements in
geometry modeling, mesh functionality, source specification, depletion
capabilities, and other general enhancements. The depletion module features a
new transport operator, :class:`openmc.deplete.IndependentOperator`, that allows
a depletion calculation to be performed using arbitrary one-group cross sections
(e.g., generated by an external solver) along with a
:class:`openmc.deplete.MicroXS` class for managing one-group cross sections. The
track file generation capability has been significantly overhauled and a new
:class:`openmc.Tracks` class was introduced to allow access to information in
track files from the Python API. Support has been added for new ENDF thermal
scattering evaluations that use mixed coherent/incoherent elastic scattering.
------------------------------------
Compatibility Notes and Deprecations
------------------------------------
- The ``openmc.deplete.Operator`` class has been renamed
:class:`openmc.deplete.CoupledOperator`.
- The ``openmc.deplete.ResultsList`` class has been renamed to
:class:`openmc.deplete.Results` and no longer requires you to call the
``from_hdf5()`` method in order to create it; instead, you can directly
instantiate it.
- A few methods that represent k-effective have been renamed for the sake of
consistency:
- ``openmc.StatePoint.k_combined`` is now :attr:`openmc.StatePoint.keff`
- ``openmc.deplete.ResultsList.get_eigenvalue`` is now
:meth:`openmc.deplete.Results.get_keff`
- The :class:`openmc.stats.SphericalIndependent` class, which used to
accept a distribution for ``theta`` now accepts a distribution for ``cos_theta``
instead in order to more easily handle the common case of specifying a uniform
spatial distribution over a sphere (also see the new
:func:`openmc.stats.spherical_uniform` function).
- If you are building OpenMC from source, note that several of our CMake options
have been changed:
========== ======================
Old option New option
========== ======================
debug ---
optimize ---
profile OPENMC_ENABLE_PROFILE
coverage OPENMC_ENABLE_COVERAGE
openmp OPENMC_USE_OPENMP
--- OPENMC_USE_MPI
dagmc OPENMC_USE_DAGMC
libmesh OPENMC_USE_LIBMESH
========== ======================
The ``debug`` and ``optimize`` options have been removed; instead, use the
standard `CMAKE_BUILD_TYPE
<https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html>`_
variable.
------------
New Features
------------
- Two new composite surfaces: :class:`openmc.model.IsogonalOctagon` and
:class:`openmc.model.CylinderSector`.
- The :class:`~openmc.DAGMCUniverse` class now has a
:attr:`~openmc.DAGMCUniverse.bounding_box` attribute and a
:meth:`~openmc.DAGMCUniverse.bounding_region` method.
- When translating a :class:`~openmc.Region` using the
:meth:`~openmc.Region.translate` method, there is now an ``inplace`` argument.
- The :class:`~openmc.Material` class has several new methods and attributes:
- The :meth:`~openmc.Material.add_components` methods allows you to add
multiple nuclides/elements to a material with a single call by passing a
dictionary.
- The :meth:`~openmc.Material.get_activity` method returns the activity of a
material in Bq, Bq/g, or Bq/cm³.
- The :meth:`~openmc.Material.remove_element` method removes an element from a
material
- The :meth:`~openmc.Material.get_nuclide_atoms` method gives the number of
atoms of each nuclide in a material
- All mesh classes now have a ``volumes`` property that provides the volume of
each mesh element as well as ``write_data_to_vtk`` methods.
- Support for externally managed MOAB meshes or libMesh meshes.
- Multiple discrete distributions can be merged with the new
:meth:`~openmc.stats.Discrete.merge` method.
- The :func:`openmc.stats.spherical_uniform` function creates a uniform
distribution over a sphere using the
:class:`~openmc.stats.SphericalIndependent` class.
- Univariate distributions in the :mod:`openmc.stats` module now have
``sample()`` methods.
- An ``openmc_sample_external_source`` function has been added to the C API with
a corresponding Python binding :func:`openmc.lib.sample_external_source`.
- The track file generation capability has been completely overhauled. Track
files now include much more information, and a new :class:`~openmc.Tracks`
class allows access to track file information from the Python API and has a
:meth:`~openmc.Tracks.write_to_vtk` method for writing a VTK file. Multiple
tracks are now written to a single file (one per MPI rank).
- A new :func:`openmc.wwinp_to_wws` function that converts weight windows from a
``wwinp`` file to a list of :class:`~openmc.WeightWindows` objects.
- The new :meth:`openmc.EnergyFilter.from_group_structure` method provides a
way of creating an energy filter with a group structure identified by name.
- The :class:`openmc.data.Decay` class now has a
:attr:`~openmc.data.Decay.sources` property that provides radioactive decay
source distributions.
- A :class:`openmc.mgxs.ReducedAbsorptionXS` class produces a multigroup cross
section representing "reduced" absorption (absorption less neutron production
from (n,xn) reactions).
- Added support in the Python API and HDF5 nuclear data format for new ENDF
thermal neutron scattering evaluations with mixed coherent elastic and
incoherent elastic.
- CMake now relies on ``find_package(MPI)`` for a more standard means of
identifying an MPI compiler configuration.
---------
Bug Fixes
---------
- `Fix bug when a rotation matrix is passed to Halfspace.rotate <https://github.com/openmc-dev/openmc/pull/1974>`_
- `Fix bug for spherical mesh string repr <https://github.com/openmc-dev/openmc/pull/1983>`_
- `Fix package_data specification to include pyx files <https://github.com/openmc-dev/openmc/pull/1989>`_
- `Allow meshes with same ID to appear in multiple files <https://github.com/openmc-dev/openmc/pull/1990>`_
- `Fix overwritten variable in get_libraries_from_xsdata <https://github.com/openmc-dev/openmc/pull/1994>`_
- `Write output files to correct directory <https://github.com/openmc-dev/openmc/pull/1998>`_
- `Allow CMake to properly find third-party packages <https://github.com/openmc-dev/openmc/pull/2006>`_
- `Fix Region.from_expression when ")(" appears in specification <https://github.com/openmc-dev/openmc/pull/2012>`_
- `Move lost particle reset from finalize() to reset() <https://github.com/openmc-dev/openmc/pull/2015>`_
- `Minor typo fixes in test_lattice.py <https://github.com/openmc-dev/openmc/pull/2024>`_
- `Fix color assignment in Universe.plot <https://github.com/openmc-dev/openmc/pull/2034>`_
- `Several depletion-related fixes <https://github.com/openmc-dev/openmc/pull/2037>`_
- `Allow control of C++ standard used by compiler <https://github.com/openmc-dev/openmc/pull/2040/files>`_
- `Fix IO format documentation for surface source read/write <https://github.com/openmc-dev/openmc/pull/2048>`_
- `Make sure basis gets set in Plot.from_geometry <https://github.com/openmc-dev/openmc/pull/2050>`_
- `Improve robustness of torus distance calculation <https://github.com/openmc-dev/openmc/pull/2053>`_
- `Allow use of redundant fission when adjusting KERMA in from_njoy <https://github.com/openmc-dev/openmc/pull/2055>`_
- `Disable GNU extensions for CMake target <https://github.com/openmc-dev/openmc/pull/2072>`_
- `Two from_xml fixes <https://github.com/openmc-dev/openmc/pull/2074>`_
- `Fix for rare infinite loop when finding cell <https://github.com/openmc-dev/openmc/pull/2075>`_
- `Allow photon heating to be tallied by nuclide <https://github.com/openmc-dev/openmc/pull/2076>`_
- `Use UTF-8 encoding when reading dose coefficients <https://github.com/openmc-dev/openmc/pull/2078>`_
- `Fix a corner case in Region.from_expression <https://github.com/openmc-dev/openmc/pull/2081>`_
- `Fix bug in spherical and cylindrical meshes <https://github.com/openmc-dev/openmc/pull/2108>`_
- `Ensure weight window bounds are flattened when writing to XML <https://github.com/openmc-dev/openmc/pull/2113>`_
- `Fix for std::cout sync bug in output.cpp <https://github.com/openmc-dev/openmc/pull/2122>`_
- `Allow compiling against fmt v9 <https://github.com/openmc-dev/openmc/pull/2136>`_
- `Fix TimeFilter for small time intervals <https://github.com/openmc-dev/openmc/pull/2168>`_
------------
Contributors
------------
- `David Andrs <https://github.com/andrsd>`_
- `Hunter Belanger <https://github.com/HunterBelanger>`_
- `Helen Brooks <https://github.com/helen-brooks>`_
- `Rémi Delaporte-Mathurin <https://github.com/RemDelaporteMathurin>`_
- `Joffrey Dorville <https://github.com/JoffreyDorville>`_
- `Christopher Fichtlscherer <https://github.com/cfichtlscherer>`_
- `Lewis Gross <https://github.com/lewisgross1296>`_
- `Andrew Johnson <https://github.com/drewejohnson>`_
- `Kalin Kiesling <https://github.com/kkiesling>`_
- `Amanda Lund <https://github.com/amandalund>`_
- `Richard Morrison <https://github.com/richmorrison>`_
- `Patrick Myers <https://github.com/myerspat>`_
- `Adam Nelson <https://github.com/nelsonag>`_
- `April Novak <https://github.com/aprilnovak>`_
- `Ethan Peterson <https://github.com/eepeterson>`_
- `Gavin Ridley <https://github.com/gridley>`_
- `Paul Romano <https://github.com/paulromano>`_
- `Jonathan Shimwell <https://github.com/Shimwell>`_
- `Patrick Shriwise <https://github.com/pshriwise>`_
- `Amelia Trainer <https://github.com/ameliojo>`_
- `John Tramm <https://github.com/jtramm>`_
- `Bob Urberger <https://github.com/burberger>`_
- `Olek Yardas <https://github.com/yardasol>`_

View file

@ -0,0 +1,99 @@
====================
What's New in 0.13.2
====================
.. currentmodule:: openmc
-------
Summary
-------
This release of OpenMC includes several bug fixes, performance improvements for
complex geometries and depletion simulations, and other general enhancements.
Notably, a capability has been added to compute the photon spectra from decay of
unstable nuclides. Alongside that, a new :data:`openmc.config` configuration
variable has been introduced that allows easier configuration of data sources.
Additionally, users can now perform cell or material rejection when sampling
external source distributions.
------------------------------------
Compatibility Notes and Deprecations
------------------------------------
- If you are building against libMesh for unstructured mesh tally support,
version 1.6 or higher is now required.
- The ``openmc.stats.Muir`` class has been replaced by a
:func:`openmc.stats.muir` function that returns an instance of
:class:`openmc.stats.Normal`.
------------
New Features
------------
- The :meth:`openmc.Material.get_nuclide_atom_densities` method now takes an
optional ``nuclide`` argument.
- Functions/methods in the :mod:`openmc.deplete` module now accept times in
Julian years (``'a'``).
- The :meth:`openmc.Universe.plot` method now allows a pre-existing axes object
to be passed in.
- Performance optimization for geometries with many complex regions.
- Performance optimization for depletion by avoiding deepcopies and caching
reaction rates.
- The :class:`openmc.RegularMesh` class now has a
:meth:`~openmc.RegularMesh.from_domain` classmethod.
- The :class:`openmc.CylindricalMesh` class now has a
:meth:`~openmc.CylindricalMesh.from_domain` classmethod.
- Improved method to condense diffusion coefficients from the :mod:`openmc.mgxs`
module.
- A new :data:`openmc.config` configuration variable has been introduced that
allows data sources to be specified at runtime or via environment variables.
- The :class:`openmc.EnergyFunctionFilter` class now supports multiple
interpolation schemes, not just linear-linear interpolation.
- The :class:`openmc.DAGMCUniverse` class now has ``material_names``,
``n_cells``, and ``n_surfaces`` attributes.
- A new :func:`openmc.data.decay_photon_energy` function has been added that
returns the energy spectrum of photons emitted from the decay of an unstable
nuclide.
- The :class:`openmc.Material` class also has a new
:attr:`~openmc.Material.decay_photon_energy` attribute that gives the decay
photon energy spectrum from the material based on its constituent nuclides.
- The :class:`openmc.deplete.StepResult` now has a
:meth:`~openmc.deplete.StepResult.get_material` method.
- The :class:`openmc.Source` class now takes a ``domains`` argument that
specifies a list of cells, materials, or universes that is used to reject
source sites (i.e., if the sampled sites are not within the specified domain,
they are rejected).
---------
Bug Fixes
---------
- `Delay call to Tally::set_strides <https://github.com/openmc-dev/openmc/pull/2183>`_
- `Fix reading reference direction from XML for angular distributions <https://github.com/openmc-dev/openmc/pull/2204>`_
- `Fix erroneous behavior in Material.add_components <https://github.com/openmc-dev/openmc/pull/2205>`_
- `Fix reading thermal elastic data from ACE <https://github.com/openmc-dev/openmc/pull/2226>`_
- `Fix reading source file with time attribute <https://github.com/openmc-dev/openmc/pull/2228>`_
- `Fix conversion of multiple thermal scattering data files from ACE <https://github.com/openmc-dev/openmc/pull/2232>`_
- `Fix reading values from wwinp file <https://github.com/openmc-dev/openmc/pull/2242>`_
- `Handle possibility of .ppm file in Universe.plot <https://github.com/openmc-dev/openmc/pull/2251>`_
- `Update volume calc types to mitigate overflow issues <https://github.com/openmc-dev/openmc/pull/2270>`_
------------
Contributors
------------
- `Lewis Gross <https://github.com/lewisgross1296>`_
- `Andrew Johnson <https://github.com/drewejohnson>`_
- `Miriam Kreher <https://github.com/mkreher13>`_
- `James Logan <https://github.com/jlogan03>`_
- `Jose Ignacio Marquez Damien <https://github.com/marquezj>`_
- `Josh May <https://github.com/joshmay1>`_
- `Patrick Myers <https://github.com/myerspat>`_
- `Adam Nelson <https://github.com/nelsonag>`_
- `April Novak <https://github.com/aprilnovak>`_
- `Ethan Peterson <https://github.com/eepeterson>`_
- `Gavin Ridley <https://github.com/gridley>`_
- `Paul Romano <https://github.com/paulromano>`_
- `Patrick Shriwise <https://github.com/pshriwise>`_
- `Jonathan Shimwell <https://github.com/Shimwell>`_
- `Olek Yardas <https://github.com/yardasol>`_

View file

@ -0,0 +1,134 @@
====================
What's New in 0.13.3
====================
.. currentmodule:: openmc
-------
Summary
-------
This release of OpenMC includes many bug fixes, performance improvements, and
several notable new features. Some of the highlights include support for MCPL
source files, NCrystal thermal scattering materials, and a new
:class:`openmc.stats.MeshSpatial` class that allows a source distribution to be
specified over a mesh. Additionally, OpenMC now allows you to export your model
as a single XML file rather than separate XML files for geometry, materials,
settings, and tallies.
------------------------------------
Compatibility Notes and Deprecations
------------------------------------
- Atomic mass data used in :func:`openmc.data.atomic_mass` has been updated to
AME 2020, which results in slightly different masses.
------------
New Features
------------
- Support was added for `MCPL <https://mctools.github.io/mcpl/>`_ files to be
used as external sources. Additionally, source points and surfaces sources can
be written as MCPL files instead of HDF5 files. (`#2116
<https://github.com/openmc-dev/openmc/pull/2116>`_)
- Support was added for `NCrystal <https://github.com/mctools/ncrystal>`_
thermal scattering materials. (`#2222
<https://github.com/openmc-dev/openmc/pull/2222>`_)
- The :class:`~openmc.CylindricalMesh` and :class:`~openmc.SphericalMesh`
classes now have an ``origin`` attribute that changes the center of the mesh.
(`#2256 <https://github.com/openmc-dev/openmc/pull/2256>`_)
- A new :class:`openmc.model.Polygon` class allows defining generalized 2D
polygons. (`#2266 <https://github.com/openmc-dev/openmc/pull/2266>`_)
- A new :func:`openmc.data.decay_energy` function and
:meth:`openmc.Material.get_decay_heat` method enable determination of decay
heat from a single nuclide or material. (`#2287
<https://github.com/openmc-dev/openmc/pull/2287>`_)
- Full models can now be written as a single XML file rather than separate
geometry, materials, settings, and tallies XML files. (`#2291
<https://github.com/openmc-dev/openmc/pull/2291>`_)
- Discrete distributions are now sampled using alias sampling, which is O(1) in
time. (`#2329 <https://github.com/openmc-dev/openmc/pull/2329>`_)
- The new :class:`openmc.stats.MeshSpatial` allows a spatial source distribution
to be specified with source strengths for each mesh element. (`#2334
<https://github.com/openmc-dev/openmc/pull/2334>`_)
- The new :meth:`openmc.Geometry.get_surfaces_by_name` method returns a list of
matching surfaces in a geometry. (`#2347
<https://github.com/openmc-dev/openmc/pull/2347>`_)
- A new :attr:`openmc.Settings.create_delayed_neutrons` attribute controls
whether delayed neutrons are created during a simulation. (`#2348
<https://github.com/openmc-dev/openmc/pull/2348>`_)
- The :meth:`openmc.deplete.Results.export_to_materials` method now takes a
``path`` argument. (`#2364 <https://github.com/openmc-dev/openmc/pull/2364>`_)
- A new :meth:`openmc.EnergyFilter.get_tabular` method allows one to create a
tabular distribution based on tally results using an energy filter. (`#2371
<https://github.com/openmc-dev/openmc/pull/2371>`_)
- Several methods in the :class:`openmc.Material` class that require a volume to
be set (e.g., :meth:`~openmc.Material.get_mass`) now accept a ``volume``
argument. (`#2412 <https://github.com/openmc-dev/openmc/pull/2412>`_)
---------
Bug Fixes
---------
- Fix for finding redundant surfaces (`#2263 <https://github.com/openmc-dev/openmc/pull/2263>`_)
- Adds tolerance for temperatures slightly out of bounds (`#2265 <https://github.com/openmc-dev/openmc/pull/2265>`_)
- Fix getter/setter for weight window bounds (`#2275 <https://github.com/openmc-dev/openmc/pull/2275>`_)
- Make sure Chain.reduce preserves decay source (`#2283 <https://github.com/openmc-dev/openmc/pull/2283>`_)
- Fix array shape for weight window bounds (`#2284 <https://github.com/openmc-dev/openmc/pull/2284>`_)
- Fix for non-zero CDF start points in TSL data (`#2290 <https://github.com/openmc-dev/openmc/pull/2290>`_)
- Fix a case where inelastic scattering yield is zero (`#2295 <https://github.com/openmc-dev/openmc/pull/2295>`_)
- Prevent Compton profile out-of-bounds memory access (`#2297 <https://github.com/openmc-dev/openmc/pull/2297>`_)
- Produce light particles from decay (`#2301 <https://github.com/openmc-dev/openmc/pull/2301>`_)
- Fix zero runtime attributes in depletion statepoints (`#2302 <https://github.com/openmc-dev/openmc/pull/2302>`_)
- Fix bug in openmc.Universe.get_nuclide_densities (`#2310 <https://github.com/openmc-dev/openmc/pull/2310>`_)
- Only show print output from depletion on rank 0 (`#2311 <https://github.com/openmc-dev/openmc/pull/2311>`_)
- Fix photon transport with no atomic relaxation data (`#2312 <https://github.com/openmc-dev/openmc/pull/2312>`_)
- Fix for precedence in region expressions (`#2318 <https://github.com/openmc-dev/openmc/pull/2318>`_)
- Allow source particles with energy below cutoff (`#2319 <https://github.com/openmc-dev/openmc/pull/2319>`_)
- Fix IncidentNeutron.from_njoy for high temperatures (`#2320 <https://github.com/openmc-dev/openmc/pull/2320>`_)
- Add capability to unset cell temperatures (`#2323 <https://github.com/openmc-dev/openmc/pull/2323>`_)
- Fix in plot_xs when S(a,b) tables are present (`#2335 <https://github.com/openmc-dev/openmc/pull/2335>`_)
- Various fixes for tally triggers (`#2344 <https://github.com/openmc-dev/openmc/pull/2344>`_)
- Raise error when mesh is flat (`#2363 <https://github.com/openmc-dev/openmc/pull/2363>`_)
- Don't call normalize inside Tabular.mean (`#2375 <https://github.com/openmc-dev/openmc/pull/2375>`_)
- Avoid out-of-bounds access in inelastic scatter sampling (`#2378 <https://github.com/openmc-dev/openmc/pull/2378>`_)
- Use correct direction for anisotropic fission (`#2381 <https://github.com/openmc-dev/openmc/pull/2381>`_)
- Fix several thermal scattering nuclide assignments (`#2382 <https://github.com/openmc-dev/openmc/pull/2382>`_)
- Fix _materials_by_id attribute in Model (`#2385 <https://github.com/openmc-dev/openmc/pull/2385>`_)
- Updates to batch checks for simulation restarts (`#2390 <https://github.com/openmc-dev/openmc/pull/2390>`_)
- write_data_to_vtk volume normalization correction (`#2397 <https://github.com/openmc-dev/openmc/pull/2397>`_)
- Enable generation of JEFF 3.3 depletion chain (`#2410 <https://github.com/openmc-dev/openmc/pull/2410>`_)
- Fix spherical to Cartesian coordinate conversion (`#2417 <https://github.com/openmc-dev/openmc/pull/2417>`_)
- Handle zero photon cross sections in IncidentPhoton.from_ace (`#2433 <https://github.com/openmc-dev/openmc/pull/2433>`_)
- Fix hybrid depletion when nuclides are not present (`#2436 <https://github.com/openmc-dev/openmc/pull/2436>`_)
- Fix bug in cylindrical and spherical meshes (`#2439 <https://github.com/openmc-dev/openmc/pull/2439>`_)
- Improvements to mesh radial boundary coincidence (`#2443 <https://github.com/openmc-dev/openmc/pull/2443>`_)
------------
Contributors
------------
- `Hunter Belanger <https://github.com/HunterBelanger>`_
- `Rémi Delaporte-Mathurin <https://github.com/RemDelaporteMathurin>`_
- `Christopher Fichtlscherer <https://github.com/cfichtlscherer>`_
- `Valerio Giusti <https://github.com/valeriogiusti>`_
- `Chris Keckler <https://github.com/keckler>`_
- `Kalin Kiesling <https://github.com/kkiesling>`_
- `Thomas Kittelmann <https://github.com/tkittel>`_
- `Erik Knudsen <https://github.com/ebknudsen>`_
- `Colin Larmier <https://github.com/colinelarmier>`_
- `Amanda Lund <https://github.com/amandalund>`_
- `Jose Ignacio Marquez Damien <https://github.com/marquezj>`_
- `Josh May <https://github.com/joshmay1>`_
- `Patrick Myers <https://github.com/myerspat>`_
- `Baptiste Mouginot <https://github.com/bam241>`_
- `April Novak <https://github.com/aprilnovak>`_
- `Matthew Nyberg <https://github.com/NybergWISC>`_
- `Ethan Peterson <https://github.com/eepeterson>`_
- `Gavin Ridley <https://github.com/gridley>`_
- `Paul Romano <https://github.com/paulromano>`_
- `Patrick Shriwise <https://github.com/pshriwise>`_
- `Jonathan Shimwell <https://github.com/Shimwell>`_
- `Paul Wilson <https://github.com/gonuke>`_
- `Olek Yardas <https://github.com/yardasol>`_
- `Jiankai Yu <https://github.com/rockfool>`_

View file

@ -0,0 +1,284 @@
====================
What's New in 0.14.0
====================
.. currentmodule:: openmc
-------
Summary
-------
This release of OpenMC includes many bug fixes, performance improvements, and
several notable new features. Some of the highlights include projection plots,
pulse height tallies for photons, weight window generation, and an ability to
specify continuous removal or feed of nuclides/elements during depletion.
Additionally, one of the longstanding annoyances of depletion calculations,
namely the need to include initial "dilute" nuclides, has been eliminated. There
are also a wide array of general improvements in the Python API.
------------------------------------
Compatibility Notes and Deprecations
------------------------------------
- The :class:`openmc.deplete.MicroXS` has been completely redesigned and
improved. See further comments below under "New Features". (`#2572
<https://github.com/openmc-dev/openmc/pull/2572>`_, `#2579
<https://github.com/openmc-dev/openmc/pull/2579>`_, `#2595
<https://github.com/openmc-dev/openmc/pull/2595>`_, `#2700
<https://github.com/openmc-dev/openmc/pull/2700>`_)
- The ``rectangular_prism`` function has been replaced by the
:class:`openmc.model.RectangularPrism` class and the ``hexagonal_prism``
function has been replaced by the :class:`openmc.model.HexagonalPrism` class.
Note that whereas the ``rectangular_prism`` and ``hexagonal_prism`` functions
returned a region representing the interior of the prism, the new
:class:`~openmc.model.RectangularPrism` and
:class:`~openmc.model.HexagonalPrism` classes return composite surfaces, so
you need to use the unary ``-`` or ``+`` operators to obtain a region that can
be assigned to a cell. (`#2739
<https://github.com/openmc-dev/openmc/pull/2739>`_)
- The ``Source`` class has been refactored and split up into three separate
classes: :class:`~openmc.IndependentSource`, :class:`~openmc.FileSource`, and
:class:`~openmc.CompiledSource`. (`#2524
<https://github.com/openmc-dev/openmc/pull/2524>`_)
- The ``vertices`` and ``centroids`` attributes on mesh classes now always
return Cartesian coordinates and the shape of the returned arrays has changed
to allow `ijk` indexing using a tuple (i.e., `xyz = vertices[i, j, k]`).
(`#2711 <https://github.com/openmc-dev/openmc/pull/2711>`_)
- The :attr:`openmc.Material.decay_photon_energy` attribute has been replaced by
the :meth:`openmc.Material.get_decay_photon_energy` method. (`#2715
<https://github.com/openmc-dev/openmc/pull/2715>`_)
------------
New Features
------------
- A new :class:`openmc.WireframeRayTracePlot` class enables the generation of orthographic or
perspective projection plots. (`#1926
<https://github.com/openmc-dev/openmc/pull/1926>`_)
- The :class:`openmc.model.RightCircularCylinder` class now supports optional
filleted edges. (`#2309 <https://github.com/openmc-dev/openmc/pull/2309>`_)
- Continuous removal or feed of nuclides/elements between materials can now be
modeled during depletion via the
:meth:`openmc.deplete.abc.Integrator.add_transfer_rate` method. (`#2358
<https://github.com/openmc-dev/openmc/pull/2358>`_, `#2564
<https://github.com/openmc-dev/openmc/pull/2564>`_, `#2626
<https://github.com/openmc-dev/openmc/pull/2626>`_)
- The MAGIC method for global weight window generation has been implemented as
part of the C++ API. (`#2359
<https://github.com/openmc-dev/openmc/pull/2359>`_)
- A new capability for pulse height tallies (currently limited to photons) has
been added and can be used via the "pulse-height" tally score. (`#2452
<https://github.com/openmc-dev/openmc/pull/2452>`_)
- A :class:`openmc.model.CruciformPrism` class has been added that provides a
generalized cruciform prism composite surface. (`#2457
<https://github.com/openmc-dev/openmc/pull/2457>`_)
- Type hints have been added in various places throughout the Python API.
(`#2462 <https://github.com/openmc-dev/openmc/pull/2462>`_, `#2467
<https://github.com/openmc-dev/openmc/pull/2467>`_, `#2468
<https://github.com/openmc-dev/openmc/pull/2468>`_, `#2470
<https://github.com/openmc-dev/openmc/pull/2470>`_, `#2471
<https://github.com/openmc-dev/openmc/pull/2471>`_, `#2601
<https://github.com/openmc-dev/openmc/pull/2601>`_)
- Voxel plots can now be generated through the :meth:`openmc.Plot.to_vtk`
method. (`#2464 <https://github.com/openmc-dev/openmc/pull/2464>`_)
- The :class:`openmc.mgxs.EnergyGroups` class now allows you to alternatively
pass a string of the group structure name (e.g., "CCFE-709") instead of the
energy group boundaries. (`#2466
<https://github.com/openmc-dev/openmc/pull/2466>`_)
- Several enhancements have been made to the :meth:`openmc.Universe.plot` method
(addition of axis labels with units, ability to show legend and/or outlines, automatic
determination of origin/width, ability to pass total number of pixels).
(`#2472 <https://github.com/openmc-dev/openmc/pull/2472>`_, `#2482
<https://github.com/openmc-dev/openmc/pull/2482>`_, `#2483
<https://github.com/openmc-dev/openmc/pull/2483>`_, `#2492
<https://github.com/openmc-dev/openmc/pull/2492>`_, `#2513
<https://github.com/openmc-dev/openmc/pull/2513>`_, `#2575
<https://github.com/openmc-dev/openmc/pull/2575>`_)
- Functionality in the Python dealing with bounding boxes now relies on a new
:class:`openmc.BoundingBox` class. (`#2475
<https://github.com/openmc-dev/openmc/pull/2475>`_)
- Users now have more flexibility in specifying nuclides and reactions in the
:func:`openmc.plot_xs` function. (`#2478
<https://github.com/openmc-dev/openmc/pull/2478>`_)
- The import time of the :mod:`openmc` Python module has been improved by
deferring the import of matplotlib. (`#2488
<https://github.com/openmc-dev/openmc/pull/2488>`_)
- Mesh clases in the Python API now support a ``bounding_box`` property. (`#2507
<https://github.com/openmc-dev/openmc/pull/2507>`_, `#2620
<https://github.com/openmc-dev/openmc/pull/2620>`_, `#2621
<https://github.com/openmc-dev/openmc/pull/2621>`_)
- The ``Source`` class has been refactored and split up into three separate
classes: :class:`~openmc.IndependentSource`, :class:`~openmc.FileSource`, and
:class:`~openmc.CompiledSource`. (`#2524
<https://github.com/openmc-dev/openmc/pull/2524>`_)
- Support was added for curvilinear elements when exporting cylindrical and
spherical meshes to VTK. (`#2533
<https://github.com/openmc-dev/openmc/pull/2533>`_)
- The :class:`openmc.Tally` class now has a
:attr:`~openmc.Tally.multiply_density` attribute that indicates whether
reaction rate tallies should include the number density of the nuclide of
interest. (`#2539 <https://github.com/openmc-dev/openmc/pull/2539>`_)
- The :func:`~openmc.wwinp_to_wws` function now supports ``wwinp`` files with
cylindrical or spherical meshes. (`#2556
<https://github.com/openmc-dev/openmc/pull/2556>`_)
- Depletion no longer relies on adding initial "dilute" nuclides to each
depletable material in order to compute reaction rates. (`#2559
<https://github.com/openmc-dev/openmc/pull/2559>`_, `#2568
<https://github.com/openmc-dev/openmc/pull/2568>`_)
- The :class:`openmc.deplete.Results` class now has
:meth:`~openmc.deplete.Results.get_mass` (`#2565
<https://github.com/openmc-dev/openmc/pull/2565>`_),
:meth:`~openmc.deplete.Results.get_activity` (`#2617
<https://github.com/openmc-dev/openmc/pull/2617>`_), and
:meth:`~openmc.deplete.Results.get_decay_heat` (`#2625
<https://github.com/openmc-dev/openmc/pull/2625>`_) methods.
- The :meth:`openmc.deplete.StepResult.save` method now supports a ``path``
argument. (`#2567 <https://github.com/openmc-dev/openmc/pull/2567>`_)
- The :class:`openmc.deplete.MicroXS` has been completely redesigned and
improved. First, it no longer relies on the :mod:`openmc.mgxs` module, no
longer subclasses :class:`pandas.DataFrame`, and doesn't require adding
initial "dilute" nuclides into material compositions. It now enables users to
specify an energy group structure to collect multigroup cross sections,
specify nuclides/reactions, and works with mesh domains in addition to the
existing domains. A new :func:`openmc.deplete.get_microxs_and_flux` function
was added that improves the workflow for calculating microscopic cross
sections along with fluxes. Altogether, these changes make it straightforward
to switch between coupled and independent operators for depletion/activation
calculations. (`#2572 <https://github.com/openmc-dev/openmc/pull/2572>`_,
`#2579 <https://github.com/openmc-dev/openmc/pull/2579>`_, `#2595
<https://github.com/openmc-dev/openmc/pull/2595>`_, `#2700
<https://github.com/openmc-dev/openmc/pull/2700>`_)
- The :class:`openmc.Geometry` class now has ``merge_surfaces`` and
``surface_precision`` arguments. (`#2602
<https://github.com/openmc-dev/openmc/pull/2602>`_)
- Several predefined energy group structures have been added ("MPACT-51",
"MPACT-60", "MPACT-69", "SCALE-252"). (`#2614
<https://github.com/openmc-dev/openmc/pull/2614>`_)
- When running a depletion calculation, you are now allowed to include nuclides
in the initial material compositions that do not have neutron cross sections
(decay-only nuclides). (`#2616
<https://github.com/openmc-dev/openmc/pull/2616>`_)
- The :class:`~openmc.CylindricalMesh` and :class:`~openmc.SphericalMesh`
classes can now be fully formed using the constructor. (`#2619
<https://github.com/openmc-dev/openmc/pull/2619>`_)
- A time cutoff can now be specified in the :attr:`openmc.Settings.cutoff`
attribute. (`#2631 <https://github.com/openmc-dev/openmc/pull/2631>`_)
- The :meth:`openmc.Material.add_element` method now supports a
``cross_sections`` argument that allows a cross section data source to be
specified. (`#2633 <https://github.com/openmc-dev/openmc/pull/2633>`_)
- The :class:`~openmc.Cell` class now has a :meth:`~openmc.Cell.plot` method.
(`#2648 <https://github.com/openmc-dev/openmc/pull/2648>`_)
- The :class:`~openmc.Geometry` class now has a :meth:`~openmc.Geometry.plot`
method. (`#2661 <https://github.com/openmc-dev/openmc/pull/2661>`_)
- When weight window checks are performed can now be explicitly specified with
the :attr:`openmc.Settings.weight_window_checkpoints` attribute. (`#2670
<https://github.com/openmc-dev/openmc/pull/2670>`_)
- The :class:`~openmc.Settings` class now has a
:attr:`~openmc.Settings.max_write_lost_particles` attribute that can limit the
number of lost particle files written. (`#2688
<https://github.com/openmc-dev/openmc/pull/2688>`_)
- The :class:`~openmc.deplete.CoupledOperator` class now has a
``diff_volume_method`` argument that specifies how the volume of new materials
should be determined. (`#2691
<https://github.com/openmc-dev/openmc/pull/2691>`_)
- The :meth:`openmc.DAGMCUniverse.bounding_region` method now has a
``padding_distance`` argument. (`#2701
<https://github.com/openmc-dev/openmc/pull/2701>`_)
- A new :meth:`openmc.Material.get_decay_photon_energy` method replaces the
:attr:`decay_photon_energy` attribute and includes an ability to eliminate
low-importance points. This is facilitated by a new
:meth:`openmc.stats.Discrete.clip` method. (`#2715
<https://github.com/openmc-dev/openmc/pull/2715>`_)
- The :meth:`openmc.model.Model.differentiate_depletable_mats` method allows
depletable materials to be differentiated independent of the depletion
calculation itself. (`#2718
<https://github.com/openmc-dev/openmc/pull/2718>`_)
- Albedos can now be specified on surface boundary conditions. (`#2724
<https://github.com/openmc-dev/openmc/pull/2724>`_)
---------
Bug Fixes
---------
- Enable use of NCrystal materials in plot_xs (`#2435 <https://github.com/openmc-dev/openmc/pull/2435>`_)
- Avoid segfault from extern "C" std::string (`#2455 <https://github.com/openmc-dev/openmc/pull/2455>`_)
- Fix several issues with the Model class (`#2465 <https://github.com/openmc-dev/openmc/pull/2465>`_)
- Provide alternative batch estimation message (`#2479 <https://github.com/openmc-dev/openmc/pull/2479>`_)
- Correct index check for remove_tally (`#2494 <https://github.com/openmc-dev/openmc/pull/2494>`_)
- Support for NCrystal material in from_xml_element (`#2496 <https://github.com/openmc-dev/openmc/pull/2496>`_)
- Fix compilation with gcc 5 (`#2498 <https://github.com/openmc-dev/openmc/pull/2498>`_)
- Fixed in the Tally::add_filter method (`#2501 <https://github.com/openmc-dev/openmc/pull/2501>`_)
- Fix meaning of "masking" for plots (`#2510 <https://github.com/openmc-dev/openmc/pull/2510>`_)
- Fix description of statepoint.batches in Settings class (`#2514 <https://github.com/openmc-dev/openmc/pull/2514>`_)
- Reorder list initialization of Plot constructor (`#2519 <https://github.com/openmc-dev/openmc/pull/2519>`_)
- Added mkdir to cwd argument in Model.run (`#2523 <https://github.com/openmc-dev/openmc/pull/2523>`_)
- Fix export of spherical coordinates in SphericalMesh (`#2538 <https://github.com/openmc-dev/openmc/pull/2538>`_)
- Add virtual destructor on PlottableInterface (`#2541 <https://github.com/openmc-dev/openmc/pull/2541>`_)
- Ensure parent directory is created during depletion (`#2543 <https://github.com/openmc-dev/openmc/pull/2543>`_)
- Fix potential out-of-bounds access in TimeFilter (`#2532 <https://github.com/openmc-dev/openmc/pull/2532>`_)
- Remove use of sscanf for reading surface coefficients (`#2574 <https://github.com/openmc-dev/openmc/pull/2574>`_)
- Fix torus intersection bug (`#2589 <https://github.com/openmc-dev/openmc/pull/2589>`_)
- Multigroup per-thread cache fixes (`#2591 <https://github.com/openmc-dev/openmc/pull/2591>`_)
- Bank surface source particles in all active cycles (`#2592 <https://github.com/openmc-dev/openmc/pull/2592>`_)
- Fix for muir standard deviation (`#2598 <https://github.com/openmc-dev/openmc/pull/2598>`_)
- Check for zero fission cross section (`#2600 <https://github.com/openmc-dev/openmc/pull/2600>`_)
- XML read fixes in Plot classes (`#2623 <https://github.com/openmc-dev/openmc/pull/2623>`_)
- Added infinity check in VolumeCalculation (`#2634 <https://github.com/openmc-dev/openmc/pull/2634>`_)
- Fix sampling issue in Mixture distributions (`#2658 <https://github.com/openmc-dev/openmc/pull/2658>`_)
- Prevent segfault in distance to boundary calculation (`#2659 <https://github.com/openmc-dev/openmc/pull/2659>`_)
- Several CylindricalMesh fixes (`#2676
<https://github.com/openmc-dev/openmc/pull/2676>`_, `#2680
<https://github.com/openmc-dev/openmc/pull/2680>`_, `#2684
<https://github.com/openmc-dev/openmc/pull/2684>`_, `#2710
<https://github.com/openmc-dev/openmc/pull/2710>`_)
- Add type checks on Intersection, Union, Complement (`#2685 <https://github.com/openmc-dev/openmc/pull/2685>`_)
- Fixed typo in CF4Integrator docstring (`#2704 <https://github.com/openmc-dev/openmc/pull/2704>`_)
- Ensure property setters are used in CylindricalMesh and SphericalMesh (`#2709 <https://github.com/openmc-dev/openmc/pull/2709>`_)
- Fix sample_external_source bug (`#2713 <https://github.com/openmc-dev/openmc/pull/2713>`_)
- Fix localization issue affecting openmc-plotter (`#2723 <https://github.com/openmc-dev/openmc/pull/2723>`_)
- Correct openmc.lib wrapper for evaluate_legendre (`#2729 <https://github.com/openmc-dev/openmc/pull/2729>`_)
- Bug fix in Region.from_expression during tokenization (`#2733 <https://github.com/openmc-dev/openmc/pull/2733>`_)
- Fix bug in temperature interpolation (`#2734 <https://github.com/openmc-dev/openmc/pull/2734>`_)
- Check for invalid domain IDs in volume calculations (`#2742 <https://github.com/openmc-dev/openmc/pull/2742>`_)
- Skip boundary condition check for volume calculations (`#2743 <https://github.com/openmc-dev/openmc/pull/2743>`_)
- Fix loop over coordinates for source domain rejection (`#2751 <https://github.com/openmc-dev/openmc/pull/2751>`_)
------------
Contributors
------------
- `April Novak <https://github.com/aprilnovak>`_
- `Baptiste Mouginot <https://github.com/bam241>`_
- `Ben Collins <https://github.com/bscollin>`_
- `Chritopher Billingham <https://github.com/cadarache2014>`_
- `Christopher Fichtlscherer <https://github.com/cfichtlscherer>`_
- `Christina Cai <https://github.com/christinacai123>`_
- `Lorenzo Chierici <https://github.com/church89>`_
- `Huw Rhys Jones <https://github.com/dubway420>`_
- `Emilio Castro <https://github.com/ecasglez>`_
- `Erik Knudsen <https://github.com/ebknudsen>`_
- `Ethan Peterson <https://github.com/eepeterson>`_
- `Egor Afanasenko <https://github.com/egor1abs>`_
- `Paul Wilson <https://github.com/gonuke>`_
- `Gavin Ridley <https://github.com/gridley>`_
- `Hunter Belanger <https://github.com/HunterBelanger>`_
- `Jack Fletcher <https://github.com/j-fletcher>`_
- `John Vincent Cauilan <https://github.com/johvincau>`_
- `Josh May <https://github.com/joshmay1>`_
- `John Tramm <https://github.com/jtramm>`_
- `Kevin McLaughlin <https://github.com/kevinm387>`_
- `Yue Jin <https://github.com/kingyue737>`_
- `Lewis Gross <https://github.com/lewisgross1296>`_
- `Luke Labrie-Cleary <https://github.com/LukeLabie>`_
- `Patrick Myers <https://github.com/myerspat>`_
- `Nicola Rizzi <https://github.com/nicriz>`_
- `Yuvraj Jain <https://github.com/nutcasev15>`_
- `Paul Romano <https://github.com/paulromano>`_
- `Patrick Shriwise <https://github.com/pshriwise>`_
- `Rosie Barker <https://github.com/rlbarker>`_
- `Jonathan Shimwell <https://github.com/Shimwell>`_
- `John Tchakerian <https://github.com/stchaker>`_
- `Travis Labossiere-Hickman <https://github.com/tjlaboss>`_
- `Xinyan Wang <https://github.com/XinyanBradley>`_
- `Olek Yardas <https://github.com/yardasol>`_
- `Zoe Prieto <https://github.com/zoeprieto>`_

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