Skip to content

Commit bbaf44a

Browse files
authored
Merge branch 'openmc-dev:develop' into mesh_tally_amalgamation
2 parents 3291dfd + 8e06ed8 commit bbaf44a

267 files changed

Lines changed: 11253 additions & 2831 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
LIBMESH: ${{ matrix.libmesh }}
7676
NPY_DISABLE_CPU_FEATURES: "AVX512F AVX512_SKX"
7777
OPENBLAS_NUM_THREADS: 1
78+
PYTEST_ADDOPTS: --cov=openmc --cov-report=lcov:coverage-python.lcov
7879
# libfabric complains about fork() as a result of using Python multiprocessing.
7980
# We can work around it with RDMAV_FORK_SAFE=1 in libfabric < 1.13 and with
8081
# FI_EFA_FORK_SAFE=1 in more recent versions.
@@ -171,11 +172,37 @@ jobs:
171172
uses: mxschmitt/action-tmate@v3
172173
timeout-minutes: 10
173174

174-
- name: after_success
175+
- name: Generate C++ coverage (gcovr)
175176
shell: bash
176177
run: |
177-
cpp-coveralls -i src -i include -e src/external --exclude-pattern "/usr/*" --dump cpp_cov.json
178-
coveralls --merge=cpp_cov.json --service=github
178+
# Produce LCOV directly from gcov data in the build tree
179+
gcovr \
180+
--root "$GITHUB_WORKSPACE" \
181+
--object-directory "$GITHUB_WORKSPACE/build" \
182+
--filter "$GITHUB_WORKSPACE/src" \
183+
--filter "$GITHUB_WORKSPACE/include" \
184+
--exclude "$GITHUB_WORKSPACE/src/external/.*" \
185+
--exclude "$GITHUB_WORKSPACE/src/include/openmc/external/.*" \
186+
--gcov-ignore-errors source_not_found \
187+
--gcov-ignore-errors output_error \
188+
--gcov-ignore-parse-errors suspicious_hits.warn \
189+
--print-summary \
190+
--lcov -o coverage-cpp.lcov || true
191+
192+
- name: Merge C++ and Python coverage
193+
shell: bash
194+
run: |
195+
# Merge C++ and Python LCOV into a single file for upload
196+
cat coverage-cpp.lcov coverage-python.lcov > coverage.lcov
197+
198+
- name: Upload coverage to Coveralls
199+
if: ${{ hashFiles('coverage.lcov') != '' }}
200+
uses: coverallsapp/github-action@v2
201+
with:
202+
github-token: ${{ secrets.GITHUB_TOKEN }}
203+
parallel: true
204+
flag-name: C++ and Python
205+
path-to-lcov: coverage.lcov
179206

180207
finish:
181208
needs: main
@@ -184,5 +211,5 @@ jobs:
184211
- name: Coveralls Finished
185212
uses: coverallsapp/github-action@v2
186213
with:
187-
github-token: ${{ secrets.github_token }}
214+
github-token: ${{ secrets.GITHUB_TOKEN }}
188215
parallel-finished: true

CITATION.cff

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,43 @@
1+
cff-version: 1.2.0
2+
message: "If you use this software, please cite it as below."
3+
title: OpenMC
4+
authors:
5+
- family-names: Romano
6+
given-names: Paul K.
7+
orcid: "https://orcid.org/0000-0002-1147-045X"
8+
- family-names: Shriwise
9+
given-names: Patrick C.
10+
orcid: "https://orcid.org/0000-0002-3979-7665"
11+
- family-names: Shimwell
12+
given-names: Jonathan
13+
orcid: "https://orcid.org/0000-0001-6909-0946"
14+
- family-names: Harper
15+
given-names: Sterling
16+
- family-names: Boyd
17+
given-names: Will
18+
- family-names: Nelson
19+
given-names: Adam G.
20+
orcid: "https://orcid.org/0000-0002-3614-0676"
21+
- family-names: Tramm
22+
given-names: John R.
23+
orcid: "https://orcid.org/0000-0002-5397-4402"
24+
- family-names: Ridley
25+
given-names: Gavin
26+
orcid: "https://orcid.org/0000-0003-1635-8042"
27+
- family-names: Johnson
28+
given-names: Andrew
29+
orcid: "https://orcid.org/0000-0003-2125-8775"
30+
- family-names: Peterson
31+
given-names: Ethan E.
32+
orcid: "https://orcid.org/0000-0002-5694-7194"
33+
- family-names: Herman
34+
given-names: Bryan R.
135
preferred-citation:
236
authors:
337
- family-names: Romano
438
given-names: Paul K.
539
orcid: "https://orcid.org/0000-0002-1147-045X"
6-
- final-names: Horelik
40+
- family-names: Horelik
741
given-names: Nicholas E.
842
- family-names: Herman
943
given-names: Bryan R.

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ list(APPEND libopenmc_SOURCES
338338
src/cell.cpp
339339
src/chain.cpp
340340
src/cmfd_solver.cpp
341+
src/collision_track.cpp
341342
src/cross_sections.cpp
342343
src/dagmc.cpp
343344
src/distribution.cpp

docs/source/devguide/policies.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ C++ code in OpenMC must conform to the most recent C++ standard that is fully
2121
supported in the `version of the gcc compiler
2222
<https://gcc.gnu.org/projects/cxx-status.html>`_ that is distributed with the
2323
oldest version of Ubuntu that is still within its `standard support period
24-
<https://ubuntu.com/about/release-cycle>`_. Ubuntu 20.04 LTS will be supported
25-
through April 2025 and is distributed with gcc 9.3.0, which fully supports the
24+
<https://ubuntu.com/about/release-cycle>`_. Ubuntu 22.04 LTS will be supported
25+
through April 2027 and is distributed with gcc 11.4.0, which fully supports the
2626
C++17 standard.
2727

2828
--------------------
@@ -31,5 +31,5 @@ CMake Version Policy
3131

3232
Similar to the C++ standard policy, the minimum supported version of CMake
3333
corresponds to whatever version is distributed with the oldest version of Ubuntu
34-
still within its standard support period. Ubuntu 20.04 LTS is distributed with
35-
CMake 3.16.
34+
still within its standard support period. Ubuntu 22.04 LTS is distributed with
35+
CMake 3.22.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
.. _io_collision_track:
2+
3+
===========================
4+
Collision Track File Format
5+
===========================
6+
7+
When collision tracking is enabled with ``mcpl=false`` (the default), OpenMC
8+
writes binary data to an HDF5 file named ``collision_track.h5``. The same data
9+
may also be written after each batch when multiple files are requested
10+
(``collision_track.N.h5``) or when the run is performed in parallel. The file
11+
contains the information needed to reconstruct each recorded collision.
12+
13+
The current revision of the collision track file format is 1.0.
14+
15+
**/**
16+
17+
:Attributes:
18+
- **filetype** (*char[]*) -- String indicating the type of file.
19+
For collision-track files the value is ``"collision_track"``.
20+
21+
:Datasets:
22+
23+
- **collision_track_bank** (Compound type) -- Collision information
24+
for each stored event. Each entry in the dataset corresponds to one
25+
collision and contains the following fields:
26+
27+
- ``r`` (*double[3]*) -- Position of the collision in [cm].
28+
- ``u`` (*double[3]*) -- Direction unit vector immediately after the collision.
29+
- ``E`` (*double*) -- Incident particle energy before the collision in [eV].
30+
- ``dE`` (*double*) -- Energy loss over the collision (:math:`E_\text{before} - E_\text{after}`) in [eV].
31+
- ``time`` (*double*) -- Time of the collision in [s].
32+
- ``wgt`` (*double*) -- Particle weight at the collision.
33+
- ``event_mt`` (*int*) -- ENDF MT number identifying the reaction.
34+
- ``delayed_group`` (*int*) -- Delayed neutron group index (non-zero for delayed events).
35+
- ``cell_id`` (*int*) -- ID of the cell in which the collision occurred.
36+
- ``nuclide_id`` (*int*) -- ZA identifier of the nuclide (ZZZAAAM format).
37+
- ``material_id`` (*int*) -- ID of the material containing the collision site.
38+
- ``universe_id`` (*int*) -- ID of the universe containing the collision site.
39+
- ``n_collision`` (*int*) -- Collision counter for the particle history.
40+
- ``particle`` (*int*) -- Particle type (0=neutron, 1=photon, 2=electron, 3=positron).
41+
- ``parent_id`` (*int64*) -- Unique ID of the parent particle.
42+
- ``progeny_id`` (*int64*) -- Progeny ID of the particle.
43+
44+
In an MPI run, OpenMC writes the combined dataset by gathering collision-track
45+
entries from all ranks before flushing them to disk, so the final file appears
46+
as though it were produced serially.

docs/source/io_formats/depletion_chain.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,27 @@ attributes:
5656

5757
.. _io_chain_reaction:
5858

59+
--------------------
60+
``<source>`` Element
61+
--------------------
62+
63+
The ``<source>`` element represents photon and electron sources associated with
64+
the decay of a nuclide and contains information to construct an
65+
:class:`openmc.stats.Univariate` object that represents this emission as an
66+
energy distribution. This element has the following attributes:
67+
68+
:type:
69+
The type of :class:`openmc.stats.Univariate` source term.
70+
71+
:particle:
72+
The type of particle emitted, e.g., 'photon' or 'electron'
73+
74+
:parameters:
75+
The parameters of the source term, e.g., for a
76+
:class:`openmc.stats.Discrete` source, the energies (in [eV]) at which the
77+
particles are emitted and their relative intensities in [Bq/atom] (in other
78+
words, decay constants).
79+
5980
----------------------
6081
``<reaction>`` Element
6182
----------------------

docs/source/io_formats/depletion_results.rst

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,28 @@
44
Depletion Results File Format
55
=============================
66

7-
The current version of the depletion results file format is 1.1.
7+
The current version of the depletion results file format is 1.2.
88

99
**/**
1010

1111
:Attributes: - **filetype** (*char[]*) -- String indicating the type of file.
1212
- **version** (*int[2]*) -- Major and minor version of the
1313
statepoint file format.
1414

15-
:Datasets: - **eigenvalues** (*double[][][2]*) -- k-eigenvalues at each
16-
time/stage. This array has shape (number of timesteps, number of
17-
stages, value). The last axis contains the eigenvalue and the
18-
associated uncertainty
19-
- **number** (*double[][][][]*) -- Total number of atoms. This array
20-
has shape (number of timesteps, number of stages, number of
15+
:Datasets: - **eigenvalues** (*double[][2]*) -- k-eigenvalues at each timestep.
16+
This array has shape (number of timesteps, 2). The second axis
17+
contains the eigenvalue and its associated uncertainty.
18+
- **number** (*double[][][]*) -- Total number of atoms at each
19+
timestep. This array has shape (number of timesteps, number of
2120
materials, number of nuclides).
22-
- **reaction rates** (*double[][][][][]*) -- Reaction rates used to
23-
build depletion matrices. This array has shape (number of
24-
timesteps, number of stages, number of materials, number of
25-
nuclides, number of reactions).
21+
- **reaction rates** (*double[][][][]*) -- Reaction rates at each
22+
timestep. This array has shape (number of timesteps, number of
23+
materials, number of nuclides, number of reactions). Only stored if
24+
write_rates=True.
2625
- **time** (*double[][2]*) -- Time in [s] at beginning/end of each
2726
step.
28-
- **source_rate** (*double[][]*) -- Power in [W] or source rate in
29-
[neutron/sec]. This array has shape (number of timesteps, number
30-
of stages).
27+
- **source_rate** (*double[]*) -- Power in [W] or source rate in
28+
[neutron/sec] for each timestep.
3129
- **depletion time** (*double[]*) -- Average process time in [s]
3230
spent depleting a material across all burnable materials and,
3331
if applicable, MPI processes.

docs/source/io_formats/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Output Files
4444

4545
statepoint
4646
source
47+
collision_track
4748
summary
4849
properties
4950
depletion_results

docs/source/io_formats/settings.rst

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,85 @@ source neutrons.
2020

2121
*Default*: None
2222

23+
-----------------------------
24+
``<collision_track>`` Element
25+
-----------------------------
26+
27+
The ``<collision_track>`` element indicates to track information about particle
28+
collisions based on a set of criteria and store these events in a file named
29+
``collision_track.h5``. This file records details such as the position of the
30+
interaction, direction of the incoming particle, incident energy and deposited
31+
energy, weight, time of the interaction, and the delayed neutron group (0 for
32+
prompt neutrons). Additional information such as the cell ID, material ID,
33+
universe ID, nuclide ZAID, particle type, and event MT number are also stored.
34+
Users can specify one or more criterion to filter collisions. If no criteria are
35+
specified, it defaults to tracking all collisions across the model.
36+
37+
.. warning::
38+
Storing all collisions can be very memory intensive. For more targeted
39+
tracking, users can employ a variety of parameters such as ``cell_ids``,
40+
``reactions``, ``universe_ids``, ``material_ids``, ``nuclides``, and
41+
``deposited_E_threshold`` to refine the selection of particle interactions
42+
to be banked.
43+
44+
This element can contain one or more of the following attributes or
45+
sub-elements:
46+
47+
:max_collisions:
48+
An integer indicating the maximum number of collisions to be banked per file.
49+
50+
*Default*: 1000
51+
52+
:max_collision_track_files:
53+
An integer indicating the number of collision_track files to be used.
54+
55+
*Default*: 1
56+
57+
:mcpl:
58+
An optional boolean to enable MCPL_-format instead of the native HDF5-based
59+
format. If activated, the output file name and type is changed to
60+
``collision_track.mcpl``.
61+
62+
*Default*: false
63+
64+
.. _MCPL: https://mctools.github.io/mcpl/mcpl.pdf
65+
66+
:cell_ids:
67+
A list of integers representing cell IDs to define specific cells in which
68+
collisions are to be banked.
69+
70+
*Default*: None
71+
72+
:universe_ids:
73+
A list of integers representing the universe IDs to define specific
74+
universes in which collisions are to be banked.
75+
76+
*Default*: None
77+
78+
:material_ids:
79+
A list of integers representing the material IDs to define specific
80+
materials in which collisions are to be banked.
81+
82+
*Default*: None
83+
84+
:nuclides:
85+
A list of strings representing the nuclide, to define specific
86+
define specific target nuclide collisions to be banked.
87+
88+
*Default*: None
89+
90+
:reactions:
91+
A list of integers representing the ENDF-6 format MT numbers or strings
92+
(e.g. (n,fission)) to define specific reaction types to be banked.
93+
94+
*Default*: None
95+
96+
:deposited_E_threshold:
97+
A float defining the minimum deposited energy per collision (in eV) to
98+
trigger banking.
99+
100+
*Default*: 0.0
101+
23102
----------------------------------
24103
``<confidence_intervals>`` Element
25104
----------------------------------
@@ -178,6 +257,16 @@ history-based parallelism.
178257

179258
*Default*: false
180259

260+
--------------------------------
261+
``<free_gas_threshold>`` Element
262+
--------------------------------
263+
264+
The ``<free_gas_threshold>`` element specifies the energy multiplier, expressed
265+
in units of :math:`kT`, that determines when the free gas scattering approach is
266+
used for elastic scattering. Values must be positive.
267+
268+
*Default*: 400.0
269+
181270
-----------------------------------
182271
``<generations_per_batch>`` Element
183272
-----------------------------------

docs/source/io_formats/statepoint.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ The current version of the statepoint file format is 18.1.
149149
tallies will have a value of 0 unless otherwise instructed.
150150
- **multiply_density** (*int*) -- Flag indicating whether reaction
151151
rates should be multiplied by atom density (1) or not (0).
152+
- **higher_moments** (*int*) -- Flag indicating whether
153+
higher-order tally moments are enabled (1) or not (0).
152154

153155
:Datasets: - **n_realizations** (*int*) -- Number of realizations.
154156
- **n_filters** (*int*) -- Number of filters used.

0 commit comments

Comments
 (0)