Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
3f9f0c1
Initial support for photon MGXS
paulromano Aug 3, 2026
6fe895d
Add photon MGXS regression test
paulromano Aug 9, 2026
b29af78
Use nu-scatter formalism for photon production
paulromano Aug 9, 2026
845312e
Simplify mgxs_photon test
paulromano Aug 16, 2026
6154c6b
Simplify unit tests
paulromano Aug 17, 2026
0b0d2ae
Fix slicing and condensation on photon production MGXS
paulromano Aug 23, 2026
903446c
Rename photon production matrix MGXS
paulromano Aug 27, 2026
9e79ab2
Enable multigroup photon transport in MC mode
Sep 18, 2026
58a3045
Add multigroup photon regression test
Sep 18, 2026
63c68df
Fix photon MG scoring in tally_scoring and compute multiplicity in xs…
Sep 23, 2026
5a84711
Add multigroup photon and analog nu-scatter tests
Oct 28, 2026
d4e971f
Add photon multigroup model conversion
paulromano Aug 9, 2026
fb1d8b0
Add photon random ray transport
paulromano Aug 9, 2026
86f66a0
Validate photon random ray workflow
paulromano Aug 9, 2026
1de199d
modified flat source domain
Sep 16, 2026
b9dbc8c
Keep particle_type_ where #4141 declares it
Nov 2, 2026
caab021
Update random_ray_photon reference for new default volume estimator (…
Nov 2, 2026
48eb913
Revert " modified flat source domain"
Nov 2, 2026
b802961
Docs: multigroup photon MC transport is supported via #4141
Nov 3, 2026
e7ca582
Better definition of source line probabilities
Nov 18, 2026
e90ff6a
Merge upstream
Nov 24, 2026
f06bdf8
new mgxs modification
Nov 24, 2026
2cb1477
Merge develop into photon random ray transport
paulromano Nov 27, 2026
8e6c82e
Check exported photon scattering in the conversion test
paulromano Nov 27, 2026
c3d6305
Preserve positional arguments for multigroup conversion
paulromano Nov 27, 2026
b23fc2c
Use physical probabilities for random ray sources
paulromano Nov 27, 2026
2d4797a
Limit derived photon multiplicity to Monte Carlo transport
paulromano Nov 27, 2026
3d89490
Use photon weight windows in MPI random ray plots
paulromano Nov 27, 2026
958c96f
Validate material-wise photon MGXS source overrides
paulromano Nov 27, 2026
f061c67
Preserve neutron MGXS tallies during model conversion
paulromano Nov 27, 2026
d56566e
Clarify photon random ray workflow and approximation
paulromano Nov 27, 2026
3b6699e
Use the physical alias table for random ray sources
paulromano Nov 27, 2026
478d0f2
Revert changes to Discrete, handle bias before Discrete constructor
paulromano Nov 27, 2026
a471539
Make particle_type normal argument on convert_to_multigroup
paulromano Nov 27, 2026
3b8828e
Validate particle types for MGXS generation sources
paulromano Nov 28, 2026
fb950d9
Remove unneeded bias check
paulromano Nov 28, 2026
286e91c
Update comment on multiplicity in xsdata.cpp
paulromano Nov 28, 2026
0b30888
Move photon transport to be a subsection of fixed source in RR user's…
paulromano Nov 28, 2026
2f9a4df
Update random ray photton docs to better separate user's guide and me…
paulromano Nov 28, 2026
7f6ae9f
Change 'particle' back to 'neutron' when talking about fission
paulromano Nov 28, 2026
faaec23
Move error message into switch statement
paulromano Nov 28, 2026
6ded75e
Preserve defaults in surrogate photon MGXS generation
paulromano Nov 28, 2026
a034458
Check random ray photon production without scattering
paulromano Nov 28, 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
87 changes: 54 additions & 33 deletions docs/source/methods/random_ray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,27 @@ random ray and Monte Carlo, however.
develop the scattering source by way of inactive batches before beginning
active batches.

.. _methods_random_ray_photon:

~~~~~~~~~~~~~~~~~~~~~
Photon Cross Sections
~~~~~~~~~~~~~~~~~~~~~

For multigroup photon cross section libraries, the ``nu-scatter matrix`` gives
the expected production of outgoing photons in each energy group. It includes
the surviving primary photon from coherent or incoherent scattering and
secondary photons from atomic relaxation, thick-target bremsstrahlung, and
positron annihilation. By default, multigroup cross-section generation uses the
continuous-energy model's atomic relaxation and electron treatment settings.

Random ray uses the angle-integrated production matrix (the zeroth angular
moment, P0) and treats outgoing photons as isotropic. This approximation can
affect spatial flux profiles when Compton scattering is strongly forward-peaked.

The photon ``absorption`` cross section describes removal of the incident
photon. Absorption is tallied independently of production because an interaction
can remove the incident photon and produce secondary photons.

.. _adjoint:

------------------------
Expand All @@ -1207,24 +1228,24 @@ lifetimes.

In OpenMC, the random ray adjoint solver is implemented simply by transposing
the scattering matrix, swapping :math:`\nu\Sigma_f` and :math:`\chi`, and then
running a normal transport solve. When no external fixed forward source is
present, or if an adjoint fixed source is specifically provided, no additional
changes are needed in the transport process. This adjoint source can
correspond, for example, to a detector response function in a particular
region. However, if an external fixed forward source is present in the
simulation problem without an adjoint fixed source, an additional step is taken
running a normal transport solve. When no external fixed forward source is
present, or if an adjoint fixed source is specifically provided, no additional
changes are needed in the transport process. This adjoint source can
correspond, for example, to a detector response function in a particular
region. However, if an external fixed forward source is present in the
simulation problem without an adjoint fixed source, an additional step is taken
to compute the accompanying forward-weighted adjoint source. In this case, the
adjoint flux does *not* represent the importance of locations in phase space to
detector response; rather, the "response" in question is a uniform distribution
of Monte Carlo particle density, making the importance provided by the adjoint
flux appropriate for use with weight window generation schemes for global
variance reduction. Thus, if using a fixed source, the forward-weighted
external source for adjoint mode is simply computed as being :math:`1 / \phi`,
where :math:`\phi` is the forward scalar flux that results from a normal
forward solve (which OpenMC will run first automatically when in adjoint mode).
The adjoint external source will be computed for each source region in the
simulation mesh, independent of any tallies. The adjoint external source is
always flat, even when a linear scattering and fission source shape is used.
adjoint flux does *not* represent the importance of locations in phase space to
detector response; rather, the "response" in question is a uniform distribution
of Monte Carlo particle density, making the importance provided by the adjoint
flux appropriate for use with weight window generation schemes for global
variance reduction. Thus, if using a fixed source, the forward-weighted
external source for adjoint mode is simply computed as being :math:`1 / \phi`,
where :math:`\phi` is the forward scalar flux that results from a normal
forward solve (which OpenMC will run first automatically when in adjoint mode).
The adjoint external source will be computed for each source region in the
simulation mesh, independent of any tallies. The adjoint external source is
always flat, even when a linear scattering and fission source shape is used.

When in adjoint mode, all reported results (e.g., tallies, eigenvalues, etc.)
are derived from the adjoint flux, even when the physical meaning is not
Expand Down Expand Up @@ -1254,17 +1275,17 @@ assigned to MPI ranks (and thus Voronoi regions) using a formula that evaluates
the distance between the first intersection point :math:`\mathbf{x}` of a ray
with that source region and the Voronoi region centroid
:math:`\mathbf{c}_{\mathrm{rank}}`, combined with an additive weight
:math:`\omega_{\mathrm{rank}}`:
:math:`\omega_{\mathrm{rank}}`:

.. math::
.. math::
:label: mpi_ownership
\mathrm{rank}(\mathbf{x}) = \arg\min_{\text{rank}}
\left(\|\mathbf{c}_{\mathrm{rank}} - \mathbf{x}\|^2 -

\mathrm{rank}(\mathbf{x}) = \arg\min_{\text{rank}}
\left(\|\mathbf{c}_{\mathrm{rank}} - \mathbf{x}\|^2 -
\omega_{\mathrm{rank}} \right)\;\mathrm{.}

The initial weight is zero and subsequently changed for load balancing. This
approach yields compact MPI rank subdomains.
approach yields compact MPI rank subdomains.

In the OpenMC random ray implementation, the algorithm is not aware of the
source regions in the geometry a priori. Instead, source regions are discovered
Expand All @@ -1285,7 +1306,7 @@ information is shared across all MPI ranks and saved in a decomposition map.
This decomposition map is used to look up the responsible MPI rank every time a
ray enters a source region that has already been recorded, thereby avoiding the
need to evaluate Equation :eq:`mpi_ownership` again, which can be time-intensive
if many MPI ranks are present.
if many MPI ranks are present.

~~~~~~~~~~~~~~~~~
Ray Communication
Expand Down Expand Up @@ -1315,7 +1336,7 @@ are still performing their calculations. In many computational fields, the
amount of work that is performed is fixed per source region. In such cases, the
overall load is simply a function of how many source regions are contained
within a given subdomain, with each source region requiring the same set of
operations to be performed.
operations to be performed.

However, in random ray, the load for a given source region is much
more complex to determine. When a ray crosses a cell, the angular flux increment
Expand All @@ -1332,7 +1353,7 @@ in a source region :math:`i`, and 2) the number of surface ray trace operations
region:

.. math::
\mathrm{load}_{\mathrm{estimate}, i} = F_{r} \cdot \left(C_1 \cdot
\mathrm{load}_{\mathrm{estimate}, i} = F_{r} \cdot \left(C_1 \cdot
n_{\mathrm{hits}, i} \cdot N_{G} + C_2 \cdot n_{\mathrm{RT}, i} \right)\;
\mathrm{.}

Expand All @@ -1350,27 +1371,27 @@ diagnostics.
Based on these load estimates, a load balancing routine tries to equalize the
work per MPI rank. To do so, the weights
:math:`\omega_{\mathrm{rank}}` in Equation :eq:`mpi_ownership` are
adjusted according to the deviation of the estimated rank load
adjusted according to the deviation of the estimated rank load

.. math::
\mathrm{load}_{\mathrm{estimate}, \mathrm{rank}} = \frac{\sum\limits_{i \,
\mathrm{load}_{\mathrm{estimate}, \mathrm{rank}} = \frac{\sum\limits_{i \,
\in \, \mathrm{rank}} \mathrm{load}_{\mathrm{estimate},i}}{\sum\limits_{i=1}
^{M} \mathrm{load}_{\mathrm{estimate}, i}}
from the target load

from the target load

.. math::
\mathrm{load}_{\mathrm{target}} = \frac{1}{N_{\mathrm{rank}}}\;\mathrm{,}

where :math:`N_{\mathrm{rank}}` is the total number of MPI ranks.
where :math:`N_{\mathrm{rank}}` is the total number of MPI ranks.

Changes to the weights :math:`\mathbf{\omega_{\mathrm{rank}}}` increase or
decrease the reach of a specific MPI rank, and thus the number of source regions
that belong to it. After each weight change, the rank load estimates are updated
according to the anticipated changes in the ownership of source regions, and the
new load estimates are then used again to calculate new weights. These load
optimization iterations continue until the estimated load imbalance is smaller
than 1% or until a maximum of 200 iterations is reached.
than 1% or until a maximum of 200 iterations is reached.

After the load balancing, numerous source regions will belong to new MPI ranks.
The corresponding cell data is transferred to the new owner ranks and erased
Expand All @@ -1380,7 +1401,7 @@ restricted to the first 5 simulation batches. Because random ray simulations
should use an appropriately large ray population, it is expected that sufficient
load estimate data has been recorded for the vast majority of cells after 5
batches, and the load per MPI rank will not change significantly beyond
stochastic fluctuations associated with the changing quadrature.
stochastic fluctuations associated with the changing quadrature.

---------------------------
Fundamental Sources of Bias
Expand Down
26 changes: 26 additions & 0 deletions docs/source/usersguide/random_ray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,32 @@ points of 1.0e-2 and 1.0e1.
# Add fixed source and ray sampling source to settings file
settings.source = [neutron_source]

~~~~~~~~~~~~~~~~
Photon Transport
~~~~~~~~~~~~~~~~

The random ray solver supports forward fixed-source photon calculations. A
continuous-energy photon model can be converted and run with the same workflow
used for neutron models::

model.settings.run_mode = 'fixed source'
model.settings.source = openmc.IndependentSource(..., particle='photon')

model.convert_to_multigroup(
groups=[1.0e3, 1.0e5, 5.0e5, 1.1e6],
particle_type='photon',
...
)
model.convert_to_random_ray()
model.run()

The source and the multigroup library must both specify photons. The group
structure should span the source spectrum and the secondary photon energies of
interest, with its lower boundary consistent with the photon energy cutoff. Note
that photon adjoint and coupled neutron--photon solves are not yet supported.
See :ref:`methods_random_ray_photon` for the cross-section representation and
angular approximation.

.. _usersguide_vol_estimators:

-----------------------------
Expand Down
4 changes: 2 additions & 2 deletions include/openmc/random_ray/flat_source_domain.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class FlatSourceDomain {

//----------------------------------------------------------------------------
// Methods
virtual void update_single_neutron_source(SourceRegionHandle& srh);
virtual void update_all_neutron_sources();
virtual void update_single_particle_source(SourceRegionHandle& srh);
virtual void update_all_particle_sources();
void compute_k_eff();
virtual void normalize_scalar_flux_and_volumes(
double total_active_distance_per_iteration);
Expand Down
2 changes: 1 addition & 1 deletion include/openmc/random_ray/linear_source_domain.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LinearSourceDomain : public FlatSourceDomain {
public:
//----------------------------------------------------------------------------
// Methods
void update_single_neutron_source(SourceRegionHandle& srh) override;
void update_single_particle_source(SourceRegionHandle& srh) override;
void normalize_scalar_flux_and_volumes(
double total_active_distance_per_iteration) override;

Expand Down
Loading
Loading