mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Restricted file source (#2916)
Co-authored-by: church89 <l.chierici89@gmail.com> Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
a7d6939c11
commit
1702b4554b
32 changed files with 823 additions and 240 deletions
|
|
@ -534,8 +534,9 @@ attributes/sub-elements:
|
|||
*Default*: 1.0
|
||||
|
||||
:type:
|
||||
Indicator of source type. One of ``independent``, ``file``, ``compiled``, or ``mesh``.
|
||||
The type of the source will be determined by this attribute if it is present.
|
||||
Indicator of source type. One of ``independent``, ``file``, ``compiled``, or
|
||||
``mesh``. The type of the source will be determined by this attribute if it
|
||||
is present.
|
||||
|
||||
:particle:
|
||||
The source particle type, either ``neutron`` or ``photon``.
|
||||
|
|
@ -716,6 +717,39 @@ attributes/sub-elements:
|
|||
mesh element and follows the format for :ref:`source_element`. The number of
|
||||
``<source>`` sub-elements should correspond to the number of mesh elements.
|
||||
|
||||
:constraints:
|
||||
This sub-element indicates the presence of constraints on sampled source
|
||||
sites (see :ref:`usersguide_source_constraints` for details). It may have
|
||||
the following sub-elements:
|
||||
|
||||
:domain_ids:
|
||||
The unique IDs of domains for which source sites must be within.
|
||||
|
||||
*Default*: None
|
||||
|
||||
:domain_type:
|
||||
The type of each domain for source rejection ("cell", "material", or
|
||||
"universe").
|
||||
|
||||
*Default*: None
|
||||
|
||||
:fissionable:
|
||||
A boolean indicating whether source sites must be sampled within a
|
||||
material that is fissionable in order to be accepted.
|
||||
|
||||
:time_bounds:
|
||||
A pair of times in [s] indicating the lower and upper bound for a time
|
||||
interval that source particles must be within.
|
||||
|
||||
:energy_bounds:
|
||||
A pair of energies in [eV] indicating the lower and upper bound for an
|
||||
energy interval that source particles must be within.
|
||||
|
||||
:rejection_strategy:
|
||||
Either "resample", indicating that source sites should be resampled when
|
||||
one is rejected, or "kill", indicating that a rejected source site is
|
||||
assigned zero weight.
|
||||
|
||||
.. _univariate:
|
||||
|
||||
Univariate Probability Distributions
|
||||
|
|
|
|||
|
|
@ -420,6 +420,54 @@ string, which gets passed down to the ``openmc_create_source()`` function::
|
|||
|
||||
settings.source = openmc.CompiledSource('libsource.so', '3.5e6')
|
||||
|
||||
.. _usersguide_source_constraints:
|
||||
|
||||
Source Constraints
|
||||
------------------
|
||||
|
||||
All source classes in OpenMC have the ability to apply a set of "constraints"
|
||||
that limit which sampled source sites are actually used for transport. The most
|
||||
common use case is to sample source sites over some simple spatial distribution
|
||||
(e.g., uniform over a box) and then only accept those that appear in a given
|
||||
cell or material. This can be done with a domain constraint, which can be
|
||||
specified as follows::
|
||||
|
||||
source_cell = openmc.Cell(...)
|
||||
...
|
||||
|
||||
spatial_dist = openmc.stats.Box((-10., -10., -10.), (10., 10., 10.))
|
||||
source = openmc.IndependentSource(
|
||||
space=spatial_dist,
|
||||
constraints={'domains': [source_cell]}
|
||||
)
|
||||
|
||||
For k-eigenvalue problems, a convenient constraint is available that limits
|
||||
source sites to those sampled in a fissionable material::
|
||||
|
||||
source = openmc.IndependentSource(
|
||||
space=spatial_dist, constraints={'fissionable': True}
|
||||
)
|
||||
|
||||
Constraints can also be placed on a range of energies or times::
|
||||
|
||||
# Only use source sites between 500 keV and 1 MeV and with times under 1 sec
|
||||
source = openmc.FileSource(
|
||||
'source.h5',
|
||||
constraints={'energy_bounds': [500.0e3, 1.0e6], 'time_bounds': [0.0, 1.0]}
|
||||
)
|
||||
|
||||
Normally, when a source site is rejected, a new one will be resampled until one
|
||||
is found that meets the constraints. However, the rejection strategy can be
|
||||
changed so that a rejected site will just not be simulated by specifying::
|
||||
|
||||
source = openmc.IndependentSource(
|
||||
space=spatial_dist,
|
||||
constraints={'domains': [cell], 'rejection_strategy': 'kill'}
|
||||
)
|
||||
|
||||
In this case, the actual number of particles simulated may be less than what you
|
||||
specified in :attr:`Settings.particles`.
|
||||
|
||||
.. _usersguide_entropy:
|
||||
|
||||
---------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue