Skip to content

Commit fbb471d

Browse files
committed
Merge branch 'develop' into IFP_beta_nuc
2 parents 7af3016 + 7106958 commit fbb471d

35 files changed

+2391
-388
lines changed

docs/source/io_formats/settings.rst

Lines changed: 95 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,15 @@ ignored for all run modes other than "eigenvalue".
277277

278278
*Default*: 1
279279

280+
------------------------------
281+
``<ifp_n_generation>`` Element
282+
------------------------------
283+
284+
The ``<ifp_n_generation>`` element indicates the number of generations to
285+
consider for the Iterated Fission Probability method.
286+
287+
*Default*: 10
288+
280289
----------------------
281290
``<inactive>`` Element
282291
----------------------
@@ -402,7 +411,25 @@ then, OpenMC will only use up to the :math:`P_1` data.
402411
``<max_history_splits>`` Element
403412
--------------------------------
404413

405-
The ``<max_history_splits>`` element indicates the number of times a particle can split during a history.
414+
The ``<max_history_splits>`` element indicates the number of times a particle
415+
can split during a history.
416+
417+
*Default*: 1000
418+
419+
-----------------------------
420+
``<max_secondaries>`` Element
421+
-----------------------------
422+
423+
The ``<max_secondaries>`` element indicates the maximum secondary bank size.
424+
425+
*Default*: 10000
426+
427+
------------------------
428+
``<max_tracks>`` Element
429+
------------------------
430+
431+
The ``<max_tracks>`` element indicates the maximum number of tracks written to a
432+
track file (per MPI process).
406433

407434
*Default*: 1000
408435

@@ -844,13 +871,18 @@ attributes/sub-elements:
844871
relative source strength of each mesh element or each point in the cloud.
845872

846873
:volume_normalized:
847-
For "mesh" spatial distrubtions, this optional boolean element specifies
874+
For "mesh" spatial distributions, this optional boolean element specifies
848875
whether the vector of relative strengths should be multiplied by the mesh
849876
element volume. This is most common if the strengths represent a source
850877
per unit volume.
851878

852879
*Default*: false
853880

881+
:bias:
882+
For "mesh" and "cloud" spatial distributions, this optional element
883+
specifies floating point values corresponding to alternative probabilities
884+
for each value/component to use for biased sampling.
885+
854886
:angle:
855887
An element specifying the angular distribution of source sites. This element
856888
has the following attributes:
@@ -883,6 +915,10 @@ attributes/sub-elements:
883915
are those of a univariate probability distribution (see the description in
884916
:ref:`univariate`).
885917

918+
:bias:
919+
For "isotropic" angular distributions, this optional element specifies a
920+
"mu-phi" angular distribution used for biased sampling.
921+
886922
:energy:
887923
An element specifying the energy distribution of source sites. The necessary
888924
sub-elements/attributes are those of a univariate probability distribution
@@ -906,6 +942,10 @@ attributes/sub-elements:
906942
mesh element and follows the format for :ref:`source_element`. The number of
907943
``<source>`` sub-elements should correspond to the number of mesh elements.
908944

945+
.. note:: Biased sampling can be applied to the spatial and energy distributions
946+
of a source by using the ``<bias>`` sub-element (see
947+
:ref:`univariate` for details on how to specify bias distributions).
948+
909949
:constraints:
910950
This sub-element indicates the presence of constraints on sampled source
911951
sites (see :ref:`usersguide_source_constraints` for details). It may have
@@ -998,13 +1038,26 @@ variable and whose sub-elements/attributes are as follows:
9981038
*Default*: histogram
9991039

10001040
:pair:
1001-
For a "mixture" distribution, this element provides a distribution and its corresponding probability.
1041+
For a "mixture" distribution, this element provides a distribution and its
1042+
corresponding probability.
10021043

10031044
:probability:
1004-
An attribute or ``pair`` that provides the probability of a univariate distribution within a "mixture" distribution.
1045+
An attribute or ``pair`` that provides the probability of a univariate
1046+
distribution within a "mixture" distribution.
10051047

10061048
:dist:
1007-
This sub-element of a ``pair`` element provides information on the corresponding univariate distribution.
1049+
This sub-element of a ``pair`` element provides information on the
1050+
corresponding univariate distribution.
1051+
1052+
:bias:
1053+
This optional element specifies a biased distribution for importance sampling.
1054+
For continuous distributions, the ``bias`` element should contain another
1055+
univariate distribution with the same support (interval) as the parent
1056+
distribution. For discrete distributions, the ``bias`` element should contain
1057+
floating point values corresponding to alternative probabilities for each
1058+
value/component to be used for biased sampling.
1059+
1060+
*Default*: None
10081061

10091062
---------------------------------------
10101063
``<source_rejection_fraction>`` Element
@@ -1352,6 +1405,15 @@ has the following attributes/sub-elements:
13521405
for fixed source and small criticality calculations, but is very
13531406
optimistic for highly coupled full-core reactor problems.
13541407

1408+
-------------------------------------
1409+
``<uniform_source_sampling>`` Element
1410+
-------------------------------------
1411+
1412+
The ``<uniform_source_sampling>`` element indicates whether to sample among
1413+
multiple sources uniformly, applying their strengths as weights to sampled
1414+
particles.
1415+
1416+
*Default*: False
13551417

13561418
------------------------
13571419
``<ufs_mesh>`` Element
@@ -1364,6 +1426,16 @@ Agency Monte Carlo Performance Benchmark Problem," Proceedings of *Physor 2012*,
13641426
Knoxville, TN (2012). The mesh should cover all possible fissionable materials
13651427
in the problem and is specified using a :ref:`mesh_element`.
13661428

1429+
-------------------------------
1430+
``<use_decay_photons>`` Element
1431+
-------------------------------
1432+
1433+
The ``<use_decay_photons>`` element indicates whether to produce decay photons
1434+
from neutron reactions instead of prompt photons. This is used in conjunction
1435+
with the direct 1-step method for shutdown dose rate calculations.
1436+
1437+
*Default*: False
1438+
13671439
.. _verbosity:
13681440

13691441
-----------------------
@@ -1594,3 +1666,21 @@ following sub-elements/attributes:
15941666

15951667
The ``weight_windows_file`` element has no attributes and contains the path to
15961668
a weight windows HDF5 file to load during simulation initialization.
1669+
1670+
-------------------------------
1671+
``<weight_windows_on>`` Element
1672+
-------------------------------
1673+
1674+
The ``weight_windows_on`` element indicates whether weight windows are
1675+
enabled.
1676+
1677+
*Default*: False
1678+
1679+
----------------------------------
1680+
``<write_initial_source>`` Element
1681+
----------------------------------
1682+
1683+
The ``write_initial_source`` element indicates whether to write the initial
1684+
source distribution to file.
1685+
1686+
*Default*: False

docs/source/methods/variance_reduction.rst

Lines changed: 76 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ not experience a single scoring event, even after billions of analog histories.
2222
Variance reduction techniques aim to either flatten the global uncertainty
2323
distribution, such that all regions of phase space have a fairly similar
2424
uncertainty, or to reduce the uncertainty in specific locations (such as a
25-
detector). There are two strategies available in OpenMC for variance reduction:
26-
the Monte Carlo MAGIC method and the FW-CADIS method. Both strategies work by
27-
developing a weight window mesh that can be utilized by subsequent Monte Carlo
28-
solves to split particles heading towards areas of lower flux densities while
29-
terminating particles in higher flux regions---all while maintaining a fair
30-
game.
25+
detector). There are three strategies available in OpenMC for variance
26+
reduction: weight windows generated via the MAGIC method or the FW-CADIS method,
27+
and source biasing. Both weight windowing strategies work by developing a mesh
28+
that can be utilized by subsequent Monte Carlo solves to split particles heading
29+
towards areas of lower flux densities while terminating particles in higher flux
30+
regions. In contrast, source biasing modifies source site sampling behavior to
31+
preferentially track particles more likely to reach phase space regions of
32+
interest.
3133

3234
------------
3335
MAGIC Method
@@ -132,3 +134,71 @@ aware of this.
132134
:label: variance_fom
133135
134136
\text{FOM} = \frac{1}{\text{Time} \times \sigma^2}
137+
138+
.. _methods_source_biasing:
139+
140+
--------------
141+
Source Biasing
142+
--------------
143+
144+
In contrast to the previous two methods that introduce population controls
145+
during transport, source biasing modifies the sampling of the external source
146+
distribution. The basic premise of the technique is that for each spatial,
147+
angular, energy, or time distribution of a source, an additional distribution
148+
can be specified provided that the two share a common support (set of points
149+
where the distribution is nonzero). Samples are then drawn from this "bias"
150+
distribution, which can be chosen to preferentially direct particles towards
151+
phase space regions of interest. In order to avoid biasing the tally results,
152+
however, a weight adjustment is applied to each sampled site as described below.
153+
154+
Assume that the unbiased probability density function of a random variable
155+
:math:`X:x \rightarrow \mathbb{R}` is given by :math:`f(x)`, but that using the
156+
biased distribution :math:`g(x)` will result in a greater number of particle
157+
trajectories reaching some phase space region of interest. Then a sample
158+
:math:`x_0` may be drawn from :math:`g(x)` while maintaining a fair game,
159+
provided that its weight is adjusted as:
160+
161+
.. math::
162+
:label: source_bias
163+
164+
w = w_0 \times \frac{f(x_0)}{g(x_0)}
165+
166+
where :math:`w_0` is the weight of an unbiased sample from :math:`f(x)`,
167+
typically unity.
168+
169+
Returning now to Equation :eq:`source_bias`, the requirement for common support
170+
becomes evident. If :math:`\mathrm{supp} (g)` fully contains but is not
171+
identical to :math:`\mathrm{supp} (f)`, then some samples from :math:`g(x)` will
172+
correspond to points where :math:`f(x) = 0`. Thus these source sites would be
173+
assigned a starting weight of 0, meaning the particles would be killed
174+
immediately upon transport, effectively wasting computation time. Conversely, if
175+
:math:`\mathrm{supp} (g)` is fully contained by but not identical to
176+
:math:`\mathrm{supp} (f)`, the contributions of some regions outside
177+
:math:`\mathrm{supp} (g)` will not be counted towards the integral, potentially
178+
biasing the tally. The weight assigned to such points would be undefined since
179+
:math:`g(x) = \mathbf{0}` at these points.
180+
181+
When an independent source is sampled in OpenMC, the particle's coordinate in
182+
each variable of phase space :math:`(\mathbf{r},\mathbf{\Omega},E,t)` is
183+
successively drawn from an independent probability distribution. Multiple
184+
variables can be biased, in which case the resultant weight :math:`w` applied to
185+
the particle is the product of the weights assigned from all sampled
186+
distributions: space, angle, energy, and time, as shown in Equation
187+
:eq:`tot_wgt`.
188+
189+
.. math::
190+
:label: tot_wgt
191+
192+
w = w_r \times w_{\Omega} \times w_E \times w_t
193+
194+
Finally, source biasing and weight windows serve different purposes. Source
195+
biasing changes how particles are born, allowing the initial source sites to be
196+
sampled preferentially from important regions of phase space (space, angle,
197+
energy, and time) with an accompanying weight adjustment. Weight windows, by
198+
contrast, apply population control during transport (splitting and Russian
199+
roulette) to help particles reach and contribute in important regions as they
200+
move through the system. Because particle transport proceeds as usual after a
201+
biased source is sampled, particle attenuation in optically thick regions
202+
outside the source volume will not be affected by source biasing; in such
203+
scenarios, transport biasing techniques such as weight windows are often more
204+
effective.

docs/source/pythonapi/mgxs.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ Module Variables
1111
.. autodata:: openmc.mgxs.GROUP_STRUCTURES
1212
:annotation:
1313

14+
Functions
15+
+++++++++
16+
17+
.. autosummary::
18+
:toctree: generated
19+
:nosignatures:
20+
:template: myfunction.rst
21+
22+
openmc.mgxs.convert_flux_groups
23+
1424
Classes
1525
+++++++
1626

docs/source/usersguide/settings.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ option::
272272
settings.source = [src1, src2]
273273
settings.uniform_source_sampling = True
274274

275+
Additionally, sampling from an :class:`openmc.IndependentSource` may be biased
276+
for local or global variance reduction by modifying the
277+
:attr:`~openmc.IndependentSource.bias` attribute of each of its four main
278+
distributions. Further discussion of source biasing can be found in
279+
:ref:`source_biasing`.
280+
275281
Finally, the :attr:`IndependentSource.particle` attribute can be used to
276282
indicate the source should be composed of particles other than neutrons. For
277283
example, the following would generate a photon source::

0 commit comments

Comments
 (0)