Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
b6339d9
Squash delta tracking commits.
nuclearkevin Feb 28, 2026
b1b8850
Fix non-vacuum BCs.
nuclearkevin May 18, 2026
b926f3d
Make non-vacuum BCs more robust.
nuclearkevin May 19, 2026
ce3c84b
Allow for the import of majorant cross sections from CSV files.
nuclearkevin May 22, 2026
2681723
Missing setting.
nuclearkevin May 22, 2026
9e634ef
Turn ptable sampling on for delta tracking.
nuclearkevin May 23, 2026
697d338
Begin majorant refactor.
nuclearkevin May 26, 2026
8ab52b2
Finish the "new" majorant implementation.
nuclearkevin May 27, 2026
2601bd5
Better error messages.
nuclearkevin May 27, 2026
bf17e62
Fix issues with URR cross sections. Make error messages better
nuclearkevin May 27, 2026
f711894
Prep for photon majorants.
nuclearkevin May 27, 2026
60c0a86
Photon majorants & delta tracking for photon transport.
nuclearkevin May 28, 2026
f879dfb
Errors for settings unsupported by delta tracking (for now).
nuclearkevin May 28, 2026
b81ddd0
Compute majorants for all materials contained in a universe.
nuclearkevin May 29, 2026
b4231bf
Fix delta tracking photon loop.
nuclearkevin May 29, 2026
28e0bd6
Minor changes.
nuclearkevin May 29, 2026
f068586
Fix bug with universe majorants & reset majorants when finalizing a s…
nuclearkevin May 30, 2026
19930b3
Support distrib densities.
nuclearkevin May 30, 2026
2c419d3
Rename delta tracking functions.
nuclearkevin May 30, 2026
5a6c7b0
Support delta tracking with a shared secondary bank.
nuclearkevin May 30, 2026
21c9d51
Remove CSV majorant cross sections.
nuclearkevin Jun 1, 2026
a3ec3f3
Revert to most conservative URR treatment.
nuclearkevin Jun 1, 2026
99f03f0
Honestly, I don't know anymore...
nuclearkevin Jun 2, 2026
6724555
Refactor history-based delta tracking to prepare for event-based.
nuclearkevin Jun 2, 2026
7a46b22
First cut of event-based transport. Works for neutrons
nuclearkevin Jun 2, 2026
ea829ef
Fixes for event-based delta tracking photon transport.
nuclearkevin Jun 3, 2026
c7d7d7b
More shuffling, add some extra division comments.
nuclearkevin Jun 3, 2026
c114b14
Remove unnecessary cross section calculation event on particle initia…
nuclearkevin Jun 3, 2026
b5cb2bf
Forgot the coord reset.
nuclearkevin Jun 3, 2026
a9c4732
Use FP_REL_PRECISION when advancing to boundaries.
nuclearkevin Jun 4, 2026
62087bf
Fix grid lookup.
nuclearkevin Jun 4, 2026
518d319
Fix majorants, again...
nuclearkevin Jun 4, 2026
1601ccd
Remove unused code.
nuclearkevin Jun 8, 2026
d26b0a9
More cleanup.
nuclearkevin Jun 8, 2026
051120c
More cleanup.
nuclearkevin Jun 8, 2026
0e40ab7
URR fix.
nuclearkevin Jun 8, 2026
5c6ca69
Have majorants conform to OpenMC's indexing approach. Also add a time…
nuclearkevin Jun 8, 2026
adf0d3a
Remove ascii file writes.
nuclearkevin Jun 8, 2026
6585cd0
Pretty formatting.
nuclearkevin Jun 8, 2026
a24306f
Restrict delta tracking tallies to collision estimators.
nuclearkevin Jun 10, 2026
6ce080c
Remove unnecessary coord reset.
nuclearkevin Jun 10, 2026
618e326
Clean up combined estimate for k.
nuclearkevin Jun 10, 2026
77b103e
Clean up majorant and remove random duplicate code.
nuclearkevin Jun 10, 2026
31cde23
Shouldn't need this going into a boundary crossing.
nuclearkevin Jun 10, 2026
0462194
Remove more duplicate flagging.
nuclearkevin Jun 10, 2026
974a593
More cleanup.
nuclearkevin Jun 10, 2026
c4b3c9d
Round trip delta_tracking alongside the majorant build time in the SP.
nuclearkevin Jun 10, 2026
fef04bc
Remove event limit.
nuclearkevin Jun 10, 2026
0d783ee
Delta tracking theory.
nuclearkevin Jun 11, 2026
dd5e60a
Test round tripping the delta tracking setting.
nuclearkevin Jun 11, 2026
ee03227
Fix distributed density majorant bug.
nuclearkevin Jun 11, 2026
93cb873
More majorant fixes.
nuclearkevin Jun 11, 2026
b67a811
Test for distributed densities with delta tracking.
nuclearkevin Jun 11, 2026
6415840
Add history-based and event-based tests with/without photons.
nuclearkevin Jun 11, 2026
59e370d
Revert "Remove unnecessary coord reset."
nuclearkevin Jun 11, 2026
61fb0f8
Regold to account for coord fix.
nuclearkevin Jun 11, 2026
d0a417e
Fix periodic boundary conditions.
nuclearkevin Jun 11, 2026
59370e9
Add tests for delta tracking boundary conditions.
nuclearkevin Jun 11, 2026
f40fcbb
Only need the tolerance on the translational periodic BC.
nuclearkevin Jun 12, 2026
ded4a27
Update tests to account for the removal of duplicate code & consolida…
nuclearkevin Jun 12, 2026
698cd26
Fix gold inputs.
nuclearkevin Jun 12, 2026
8bb79b0
Final review.
nuclearkevin Jun 12, 2026
1e4e781
Style changes.
nuclearkevin Jun 12, 2026
d36031f
URR grid index fix.
nuclearkevin Jun 13, 2026
304520f
More fixes for rare bugs that happen when finding a grid index.
nuclearkevin Jun 13, 2026
43ff851
Catch void majorants, clean up majorant killswitch.
nuclearkevin Jun 16, 2026
2c0c69a
Build majorant in parallel with OpenMP threads.
nuclearkevin Jun 16, 2026
d592293
Style changes.
nuclearkevin Jun 16, 2026
2c9c534
Consistent BC tolerance application.
nuclearkevin Jun 17, 2026
7225f1d
Advancing in time.
nuclearkevin Jun 17, 2026
b4eb579
Catch void materials.
nuclearkevin Jun 18, 2026
e1494fb
Apply more maxes to URRs.
nuclearkevin Jun 24, 2026
d070db3
Minor improvements, document statepoint changes.
nuclearkevin Jul 6, 2026
2b2eecf
Apply suggestions from code review
nuclearkevin Jul 8, 2026
fbd59f1
Keep the linter happy.
nuclearkevin Jul 8, 2026
931d71a
Documentation.
nuclearkevin Jul 8, 2026
68c735c
Address non-majorant review.
nuclearkevin Jul 8, 2026
7ae0995
Address majorant comments.
nuclearkevin Jul 8, 2026
df9f090
Formatting.
nuclearkevin Jul 8, 2026
7ad8f36
Fix copy-paste error.
nuclearkevin Jul 8, 2026
23c39c4
Fix the two-component estimator.
nuclearkevin Jul 14, 2026
878b346
Regold MG survival biasing test for the 2-component fix.
nuclearkevin Jul 13, 2026
66bf7f9
Style changes.
nuclearkevin Jul 13, 2026
a0e90d1
Regold for fixed 2-component combined estimator.
nuclearkevin Jul 14, 2026
ae48ad9
Now that it works, clean it up
nuclearkevin Jul 15, 2026
688858d
Rename gold file directories.
nuclearkevin Jul 21, 2026
15bcc53
Add to settings.xml file description.
nuclearkevin Jul 21, 2026
e74a453
Use openmc::vector.
nuclearkevin Jul 21, 2026
c9b0732
Address remaining review comments.
nuclearkevin Jul 21, 2026
937b41a
We do need this.
nuclearkevin Jul 21, 2026
64d20d5
Add a check for surface filters.
nuclearkevin Jul 21, 2026
d668ecf
Catch bug in DAGMC/MOAB.
nuclearkevin Jul 21, 2026
575e9a4
Please the linter.
nuclearkevin Jul 21, 2026
1d43d96
Update to account for inlining of electron/positron rxns.
nuclearkevin Aug 3, 2026
364f40a
Regold delta tracking photon tests to account for inlining of electro…
nuclearkevin Aug 3, 2026
d72e810
Roll the version string forward to 0.15.5
nuclearkevin Aug 3, 2026
a8af1a8
Roll the version string to 0.16.1.
nuclearkevin Aug 8, 2026
c9444cb
Style changes
nuclearkevin Sep 6, 2026
6d8d509
Style changes.
nuclearkevin Oct 10, 2026
356be8d
Minor rabbit fixes.
nuclearkevin Oct 10, 2026
848a744
Fix S(a,B) interpolation.
nuclearkevin Oct 10, 2026
8a0fc7b
Fix majorants.
nuclearkevin Oct 10, 2026
a154aea
NaN guard and regold for photon majorant fixes.
nuclearkevin Oct 10, 2026
3199f0c
Disable temperature fields in delta tracking for now.
nuclearkevin Dec 2, 2026
e1cd323
Regold for photon RNG stream changes in develop.
nuclearkevin Dec 2, 2026
64a9786
More suggestions from the rabbit. Rework event-based loop to include …
nuclearkevin Dec 2, 2026
c771102
More rabbit suggestions.
nuclearkevin Dec 3, 2026
55c5363
Catch more user errors discovered by rabbit.
nuclearkevin Dec 3, 2026
6dc9fdd
Block current scores, warn about zero fluxes in voids.
nuclearkevin Dec 3, 2026
26f1444
Harden delta tracking against bad geometries.
nuclearkevin Dec 3, 2026
7a2d2c1
Fix for more complicated boundary surfaces.
nuclearkevin Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ list(APPEND libopenmc_SOURCES
src/ifp.cpp
src/initialize.cpp
src/lattice.cpp
src/majorant.cpp
src/material.cpp
src/math_functions.cpp
src/mcpl_interface.cpp
Expand Down
8 changes: 8 additions & 0 deletions docs/source/io_formats/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@ from MF=1, MT=458 on an ENDF evaluation.

*Default*: true

----------------------------
``<delta_tracking>``
----------------------------

Whether transport should be performed with delta tracking or not.

*Default*: false

--------------------------------
``<electron_treatment>`` Element
--------------------------------
Expand Down
6 changes: 6 additions & 0 deletions docs/source/io_formats/statepoint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ The current version of the statepoint file format is 18.2.
'continuous-energy' or 'multi-group'.
- **run_mode** (*char[]*) -- Run mode used, either 'eigenvalue' or
'fixed source'.
- **photon_transport** (*bool*) -- Whether photon transport was enabled
or not.
- **delta_tracking** (*bool*) -- Whether delta tracking was enabled
or not.
- **n_particles** (*int8_t*) -- Number of particles used per generation.
- **n_batches** (*int*) -- Number of batches to simulate.
- **current_batch** (*int*) -- The number of batches already simulated.
Expand Down Expand Up @@ -182,6 +186,8 @@ All values are given in seconds and are measured on the master process.
allocating arrays, etc.
- **reading cross sections** (*double*) -- Time spent loading cross
section libraries (this is a subset of initialization).
- **build majorant** (*double*) -- Time spent constructing the majorant
cross sections. This is only saved if running with delta tracking.
- **simulation** (*double*) -- Time spent between initialization and
finalization.
- **transport** (*double*) -- Time spent transporting particles.
Expand Down
121 changes: 121 additions & 0 deletions docs/source/methods/neutron_physics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,111 @@ the formula usually used to calculate the distance to next collision is

\ell = -\frac{\ln \xi}{\Sigma_t}

.. _surface_tracking:

~~~~~~~~~~~~~~~~~~~~~~~~~
Surface Tracking
~~~~~~~~~~~~~~~~~~~~~~~~~

The development of Equation :eq:`sample-distance-2` requires the assumption
that the medium under consideration is homogeneous. To accomodate heterogeneous
geometries, a resampling scheme is used. First, the distance to the next
collision is sampled with Equation :eq:`sample-distance-2`. Then, the distance
to the nearest surface from the particle position along its current trajectory
is computed (discussed in the :ref:`methods_geometry` section). If the distance
to the nearest surface is smaller than the distance to the next collision, the
sampled distance is not statistically valid. The particle is moved to the
surface and is considered to be contained by the next geometric region. Cross
sections are recomputed, and a new distance to the next collision is sampled
with Equation :eq:`sample-distance-2`. This process repeats until the distance
to the next collision is smaller than the distance to the nearest surface,
which is when a collision is accepted. This procedure is known as surface
tracking.

Surface tracking is quite efficient when used in problems with short mean free
paths relative to the size of individual regions in the problem geometry.
Surface tracking also admits the use of the track length estimator (discussed
in the :ref:`methods_tallies` section). In problems with long mean free paths
relative to the size of geometry regions, surface tracking will require a large
number of surface distance calculations per collision. The cost of finding the
nearest surface is also non-trivial for problems that contain many geometric
regions at the same cell level (e.g. TRISO-fueled fission reactors).

.. _delta_tracking:

~~~~~~~~~~~~~~~~~~~~~~~~~
Delta Tracking
~~~~~~~~~~~~~~~~~~~~~~~~~

The disadvantages of surface tracking for certain classes of problems motivates
the development of alternative approaches which do not require distance
to surface checks. Delta tracking (also known by Woodcock tracking,
delta scattering, and null scattering) is one approach to
avoid surface geometry queries [Woodcock]_. In delta tracking, the domain is
homogenized to a majorant cross section (:math:`\Sigma_{maj}(E)`) which is
computed as the maximum total cross section over the entire problem

.. math::
:label: majorant-xs-1

\Sigma_{maj}(E) = \max_{\mathbf{r}}\left(\Sigma_{t}(\mathbf{r}, E)\right).

Particles move through this homogenized problem by sampling a distance to the
next collision with the majorant cross section instead of the total cross section

.. math::
:label: sample-distance-maj

\ell = -\frac{\ln \xi}{\Sigma_{maj}(E)}.

To recover the spatial heterogeneity present in the original simulation, the
delta tracking method formally defines the majorant cross section to be the
sum of the total cross section and a spatially-varying fictitious delta
scattering cross sections :math:`\Sigma_{\delta}(\mathbf{r}, E)`

.. math::
:label: majorant-xs-2

\Sigma_{maj}(E) = \Sigma_{t}(\mathbf{r}, E) + \Sigma_{\delta}(\mathbf{r},
E).

At the collision point computed from :eq:`sample-distance-maj` one of
two reactions could occur. The first is a real collision, which is processed
as usual. The second is known as a delta scatter event (also referred to
as a virtual or null collision), which is the reaction type associated with
:math:`\Sigma_{\delta}(\mathbf{r}, E)`. A rejection sampling test is used to
determine which collision type occurs; a random number :math:`\xi` on the
interval :math:`[0,1)` is drawn and used to check

.. math::
:label: delta-real-collision

\xi < \frac{\Sigma_t (\mathbf{r}, E)}{\Sigma_{maj} (E)}.

If the condition above is true, the collision is accepted as real. If the condition
is false, a delta scatter event has occurred and the particle continues along
its trajectory with the same energy and direction. Boundary conditions
are applied by testing the distance to the nearest external boundary and
comparing this to the distance sampled with Equation :eq:`sample-distance-maj`.
If the distance to the nearest boundary is less than the sampled distance to
the next collision, the particle crosses the external boundary.

Delta tracking is advantageous as it only requires point location checks to
determine the total cross section at each collision point to test
:eq:`delta-real-collision`. This allows for the use of continuously-varying
material properties and avoids computationally expensive distance-to-nearest-surface
calculations. Problems which contain small regions with large total
cross sections (such as burnable absorbers) will have majorant cross sections
several orders of magnitude larger than the total cross section over the majority
of the domain [Leppänen]_. This decreases the number of real collisions, and
therefore the effectiveness of delta tracking. Material discontinuities are not
considered in delta tracking, which prohibits the use of track length
estimators for quantities restricted to material/geometric subdomains (such as
reaction rates) and forces the use of the higher-variance collision
estimator (discussed in detail in the :ref:`methods_tallies` section). When compared
with surface tracking, delta tracking often performs better in problems where
the particle mean free path is larger than the distance between surfaces.

----------------------------------------------------
:math:`(n,\gamma)` and Other Disappearance Reactions
----------------------------------------------------
Expand Down Expand Up @@ -1631,6 +1736,13 @@ the unresolved range to get the actual cross sections. Lastly, the total cross
section is calculated as the sum of the elastic, fission, capture, and inelastic
cross sections.

Unresolved resonance probability tables pose a challenge when computing a majorant
cross section for :ref:`delta_tracking`. OpenMC implements a conservative approach:
the maximum total cross section is computed over all bands, which is then
interpolated to the corresponding energy using either linear or logarithmic
interpolation. This ensures the majorant bounds the total cross section at the
cost of increasing the number of delta scatters in the unresolved range.

-----------------------------
Variance Reduction Techniques
-----------------------------
Expand Down Expand Up @@ -1735,13 +1847,22 @@ types.
.. [Gelbard] Ely M. Gelbard, "Epithermal Scattering in VIM," FRA-TM-123, Argonne
National Laboratory (1979).

.. [Leppänen] J. Leppänen. "Performance of Woodcock Delta-Tracking in Lattice
Physics Applications using the Serpent Monte Carlo Reactor Physics Burnup
Calculation Code", *Annals of Nuclear Energy*, 37:715-722, 2010.

.. [Squires] G. L. Squires, *Introduction to the Theory of Thermal Neutron
Scattering*, Cambridge University Press (1978).

.. [Williams] M. M. R. Williams, *The Slowing Down and Thermalization of
Neutrons*, North-Holland Publishing Co., Amsterdam (1966). **Note:** This
book can be obtained for free from the OECD_.

.. [Woodcock] E.R. Woodcock, T. Murphy, P.J. Hemmings, and T.C. Longworth.
"Techniques used in the GEM Code for Monte Carlo Neutronics Calculations
in Reactors and other Systems of Complex Geometry", ANL-7050,
Argonne National Laboratory (1965).

.. |sab| replace:: S(:math:`\alpha,\beta,T`)

.. _SIGMA1 method: https://doi.org/10.13182/NSE76-1
Expand Down
55 changes: 50 additions & 5 deletions include/openmc/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ namespace simulation {
// is provided which controls the append operations using atomics.
extern SharedArray<EventQueueItem> calculate_fuel_xs_queue;
extern SharedArray<EventQueueItem> calculate_nonfuel_xs_queue;
extern SharedArray<EventQueueItem> calculate_majorant_xs_queue;
extern SharedArray<EventQueueItem> advance_particle_queue;
extern SharedArray<EventQueueItem> surface_crossing_queue;
extern SharedArray<EventQueueItem> collision_queue;
Expand All @@ -89,6 +90,15 @@ void free_event_queues(void);
//! \param buffer_idx The particle's actual index in the particle buffer
void dispatch_xs_event(int64_t buffer_idx);

//! Execute the death event for all particles
//
//! \param n_particles The number of particles in the particle buffer
void process_death_events(int64_t n_particles);

//==============================================================================
// Surface tracking
//==============================================================================

//! Execute the initialization event for all particles
//
//! \param n_particles The number of particles in the particle buffer
Expand All @@ -109,11 +119,6 @@ void process_surface_crossing_events();
//! Execute the collision event for all particles in this event's buffer
void process_collision_events();

//! Execute the death event for all particles
//
//! \param n_particles The number of particles in the particle buffer
void process_death_events(int64_t n_particles);

//! Process event queues until all are empty. Each iteration processes the
//! longest queue first to maximize vectorization efficiency.
void process_transport_events();
Expand All @@ -127,6 +132,46 @@ void process_transport_events();
void process_init_secondary_events(int64_t n_particles, int64_t offset,
const SharedArray<SourceSite>& shared_secondary_bank);

//==============================================================================
// Delta tracking
//==============================================================================

//! Specialization of process_init_events() for delta tracking.
//
//! \param n_particles The number of particles in the particle buffer
//! \param source_offset The offset index in the source bank to use
void process_delta_init_events(int64_t n_particles, int64_t source_offset);

//! Specialization of process_calculate_xs_events() for delta tracking.
//
//! \param queue A reference to the desired XS lookup queue
void process_delta_calculate_xs_events(SharedArray<EventQueueItem>& queue);

//! Execute the majorant calculation event for all particles in this buffer
void process_delta_calculate_majorant_events();

//! Execute the delta advance particle event for all particles in this advance
//! buffer
void process_delta_advance_particle_events();

//! Specialization of process_surface_crossing_events() for delta tracking.
void process_delta_surface_crossing_events();

//! Execute the delta tracking collision event for all particles in this event's
//! buffer
void process_delta_collision_events();

//! Specialization of process_transport_events() for delta tracking.
void process_delta_transport_events();

//! Specialization of process_init_secondary_events() for delta tracking.
//
//! \param n_particles The number of particles to initialize
//! \param offset The offset index in the shared secondary bank
//! \param shared_secondary_bank The shared secondary bank to read from
void process_delta_init_secondary_events(int64_t n_particles, int64_t offset,
const SharedArray<SourceSite>& shared_secondary_bank);

} // namespace openmc

#endif // OPENMC_EVENT_H
15 changes: 15 additions & 0 deletions include/openmc/geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ namespace model {
extern int root_universe; //!< Index of root universe
extern int n_coord_levels; //!< Number of CSG coordinate levels

//! The single root cell allowed for delta tracking
//! (containing boundary surfaces).
extern int32_t root_cell_delta;

extern vector<int64_t> overlap_check_count;

// Overlap data structures get cleared every slice_data run
Expand Down Expand Up @@ -118,10 +122,21 @@ void cross_lattice(

//==============================================================================
//! Find the next boundary a particle will intersect.
//! \param p A geometry state to compute distances with.
//! \return Boundary information corresponding to the nearest surface.
//==============================================================================

BoundaryInfo distance_to_boundary(GeometryState& p);

//==============================================================================
//! Find the next external boundary a particle will intersect.
//!
//! \param p A geometry state to compute distances with.
//! \return Boundary information corresponding to the nearest external boundary.
//==============================================================================

BoundaryInfo distance_to_external_boundary(GeometryState& p);

} // namespace openmc

#endif // OPENMC_GEOMETRY_H
Loading
Loading