Statistical weights in IndependentSource (#3195)

Co-authored-by: Paul Wilson <paul.wilson@wisc.edu>
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Zoe Prieto 2024-11-22 12:16:49 -03:00 committed by GitHub
parent 172867b1df
commit ae37d6c0da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 157 additions and 30 deletions

View file

@ -183,6 +183,7 @@ source distributions and has four main attributes that one can set:
:attr:`IndependentSource.energy`, which defines the energy distribution, and
:attr:`IndependentSource.time`, which defines the time distribution.
The spatial distribution can be set equal to a sub-class of
:class:`openmc.stats.Spatial`; common choices are :class:`openmc.stats.Point` or
:class:`openmc.stats.Box`. To independently specify distributions in the
@ -225,6 +226,7 @@ distribution. This could be a probability mass function
(:class:`openmc.stats.Tabular`). By default, if no time distribution is
specified, particles are started at :math:`t=0`.
As an example, to create an isotropic, 10 MeV monoenergetic source uniformly
distributed over a cube centered at the origin with an edge length of 10 cm, and
emitting a pulse of particles from 0 to 10 µs, one
@ -252,6 +254,24 @@ sampled 70% of the time and another that should be sampled 30% of the time::
settings.source = [src1, src2]
When the relative strengths are several orders of magnitude different, it may
happen that not enough statistics are obtained from the lower strength source.
This can be improved by sampling among the sources with equal probability,
applying the source strength as a weight on the sampled source particles. The
:attr:`Settings.uniform_source_sampling` attribute can be used to enable this
option::
src1 = openmc.IndependentSource()
src1.strength = 100.0
...
src2 = openmc.IndependentSource()
src2.strength = 1.0
...
settings.source = [src1, src2]
settings.uniform_source_sampling = True
Finally, the :attr:`IndependentSource.particle` attribute can be used to
indicate the source should be composed of particles other than neutrons. For
example, the following would generate a photon source::