Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into transfer-rates-nuc…
Browse files Browse the repository at this point in the history
…lides
  • Loading branch information
yardasol committed Jun 26, 2023
2 parents e779a39 + 787b3e0 commit ca85047
Show file tree
Hide file tree
Showing 17 changed files with 163 additions and 92 deletions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation.md
Original file line number Diff line number Diff line change
@@ -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-->
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature 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 changes: 24 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -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) 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
-->
17 changes: 5 additions & 12 deletions docs/source/devguide/docbuild.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 7 additions & 11 deletions docs/source/devguide/tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ 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
Expand Down Expand Up @@ -83,13 +79,13 @@ 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``.
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.
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
------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/devguide/workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ 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/cli/pip_install/#editable-installs>`_ so that 1)
Expand Down
2 changes: 2 additions & 0 deletions docs/source/io_formats/particle_restart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/source/io_formats/statepoint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.

**/**

Expand Down
2 changes: 1 addition & 1 deletion docs/source/quickinstall.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ distribution/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
Expand Down
23 changes: 6 additions & 17 deletions docs/source/usersguide/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ Creating Input Files
.. currentmodule:: openmc

The most rudimentary option for creating input files is to simply write them
from scratch using the :ref:`XML format specifications
<io_file_formats_input>`. This approach will feel familiar to users of other
Monte Carlo codes such as MCNP and Serpent, with the added bonus that the XML
formats feel much more "readable". Alternatively, input files can be generated
using OpenMC's :ref:`Python API <pythonapi>`, which is introduced in the
following section.
from scratch using the :ref:`XML format specifications <io_file_formats_input>`.
This approach will feel familiar to users of other Monte Carlo codes such as
MCNP and Serpent, with the added bonus that the XML formats feel much more
"readable". However, it is strongly recommended to generate input files using
OpenMC's :ref:`Python API <pythonapi>`, which is introduced in the following
section.

----------
Python API
Expand Down Expand Up @@ -178,14 +178,3 @@ energy electronvolt eV
time second s
======= ============ ======

------------------------------------
ERSN-OpenMC Graphical User Interface
------------------------------------

A third-party Java-based user-friendly graphical user interface for creating XML
input files called ERSN-OpenMC_ is developed and maintained by members of the
Radiation and Nuclear Systems Group at the Faculty of Sciences Tetouan, Morocco.
The GUI also allows one to automatically download prerequisites for installing and
running OpenMC.

.. _ERSN-OpenMC: https://github.com/EL-Bakkali-Jaafar/ERSN-OpenMC
20 changes: 10 additions & 10 deletions docs/source/usersguide/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -488,13 +488,13 @@ OpenMC locally by specifying an install prefix when running cmake:
The ``CMAKE_INSTALL_PREFIX`` variable can be changed to any path for which you
have write-access.

Compiling on Windows 10
-----------------------
Compiling on Windows
--------------------

Recent versions of Windows 10 include a subsystem for Linux that allows one to
run Bash within Ubuntu running in Windows. First, follow the installation guide
`here <https://docs.microsoft.com/en-us/windows/wsl/install-win10>`_ to get Bash
on Ubuntu on Windows setup. Once you are within bash, obtain the necessary
Recent versions of Windows include a subsystem for Linux that allows one to run
Bash within Ubuntu running in Windows. First, follow the installation guide
`here <https://learn.microsoft.com/en-us/windows/wsl/install>`_ to get Bash on
Ubuntu on Windows set up. Once you are within bash, obtain the necessary
:ref:`prerequisites <prerequisites>` via ``apt``. Finally, follow the
:ref:`instructions for compiling on linux <compile_linux>`.

Expand Down Expand Up @@ -522,7 +522,7 @@ distribution/repository, run:

.. code-block:: sh
pip install .
python -m pip install .
pip will first check that all :ref:`required third-party packages
<usersguide_python_prereqs>` have been installed, and if they are not present,
Expand Down Expand Up @@ -608,15 +608,15 @@ for OpenMC. Thus, the install process would proceed as follows:
make install
cd ..
MPICC=<path to mpicc> pip install mpi4py
HDF5_DIR=<path to HDF5> pip install --no-binary=h5py h5py
MPICC=<path to mpicc> python -m pip install mpi4py
HDF5_DIR=<path to HDF5> python -m pip install --no-binary=h5py h5py
If you are using parallel HDF5, you'll also need to make sure the right MPI
wrapper is used when installing h5py:

.. code-block:: sh
CC=<path to mpicc> HDF5_MPI=ON HDF5_DIR=<path to HDF5> pip install --no-binary=h5py h5py
CC=<path to mpicc> HDF5_MPI=ON HDF5_DIR=<path to HDF5> python -m pip install --no-binary=h5py h5py
.. _Conda: https://conda.io/en/latest/
.. _pip: https://pip.pypa.io/en/stable/
3 changes: 1 addition & 2 deletions openmc/deplete/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,7 @@ def divide_by_atoms(self, number):
Parameters
----------
number : iterable of float
Number density [atoms/b-cm] of each nuclide tracked in the
calculation.
Number of each nuclide in [atom] tracked in the calculation.
Returns
-------
Expand Down
35 changes: 15 additions & 20 deletions openmc/deplete/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"ConstantFissionYieldHelper", "FissionYieldCutoffHelper",
"AveragedFissionYieldHelper", "FluxCollapseHelper")


class TalliedFissionYieldHelper(FissionYieldHelper):
"""Abstract class for computing fission yields with tallies
Expand Down Expand Up @@ -159,22 +160,23 @@ def nuclides(self, nuclides):
def generate_tallies(self, materials, scores):
"""Produce one-group reaction rate tally
Uses the :mod:`openmc.lib` to generate a tally
of relevant reactions across all burnable materials.
Uses the :mod:`openmc.lib` to generate a tally of relevant reactions
across all burnable materials.
Parameters
----------
materials : iterable of :class:`openmc.Material`
Burnable materials in the problem. Used to
construct a :class:`openmc.MaterialFilter`
materials : iterable of :class:`openmc.lib.Material`
Burnable materials in the problem. Used to construct a
:class:`openmc.lib.MaterialFilter`
scores : iterable of str
Reaction identifiers, e.g. ``"(n, fission)"``,
``"(n, gamma)"``, needed for the reaction rate tally.
Reaction identifiers, e.g. ``"(n, fission)"``, ``"(n, gamma)"``,
needed for the reaction rate tally.
"""
self._rate_tally = Tally()
self._rate_tally.writable = False
self._rate_tally.scores = scores
self._rate_tally.filters = [MaterialFilter(materials)]
self._rate_tally.multiply_density = False
self._rate_tally_means_cache = None

@property
Expand All @@ -194,7 +196,7 @@ def reset_tally_means(self):
"""
self._rate_tally_means_cache = None

def get_material_rates(self, mat_id, nuc_index, react_index):
def get_material_rates(self, mat_id, nuc_index, rx_index):
"""Return an array of reaction rates for a material
Parameters
Expand All @@ -204,7 +206,7 @@ def get_material_rates(self, mat_id, nuc_index, react_index):
nuc_index : iterable of int
Index for each nuclide in :attr:`nuclides` in the
desired reaction rate matrix
react_index : iterable of int
rx_index : iterable of int
Index for each reaction scored in the tally
Returns
Expand All @@ -215,9 +217,8 @@ def get_material_rates(self, mat_id, nuc_index, react_index):
"""
self._results_cache.fill(0.0)
full_tally_res = self.rate_tally_means[mat_id]
for i_tally, (i_nuc, i_react) in enumerate(
product(nuc_index, react_index)):
self._results_cache[i_nuc, i_react] = full_tally_res[i_tally]
for i_tally, (i_nuc, i_rx) in enumerate(product(nuc_index, rx_index)):
self._results_cache[i_nuc, i_rx] = full_tally_res[i_tally]

return self._results_cache

Expand Down Expand Up @@ -304,6 +305,7 @@ def generate_tallies(self, materials, scores):
self._rate_tally.writable = False
self._rate_tally.scores = self._reactions_direct
self._rate_tally.filters = [MaterialFilter(materials)]
self._rate_tally.multiply_density = False
self._rate_tally_means_cache = None
if self._nuclides_direct is not None:
# check if any direct tally nuclides are requested that are not
Expand Down Expand Up @@ -375,13 +377,7 @@ def get_material_rates(self, mat_index, nuc_index, react_index):

mat = self._materials[mat_index]

# Build nucname: density mapping to enable O(1) lookup in loop below
densities = dict(zip(mat.nuclides, mat.densities))

for name, i_nuc in zip(self.nuclides, nuc_index):
# Determine density of nuclide
density = densities[name]

for mt, score, i_rx in zip(self._mts, self._scores, react_index):
if score in self._reactions_direct and name in nuclides_direct:
# Determine index in rx_rates
Expand All @@ -396,8 +392,7 @@ def get_material_rates(self, mat_index, nuc_index, react_index):
rate_per_nuc = nuc.collapse_rate(
mt, mat.temperature, self._energies, flux)

# Multiply by density to get absolute reaction rate
self._results_cache[i_nuc, i_rx] = rate_per_nuc * density
self._results_cache[i_nuc, i_rx] = rate_per_nuc

return self._results_cache

Expand Down
Loading

0 comments on commit ca85047

Please sign in to comment.