Operator->CoupledOperator

- update references in docstrings and docpages
- minor adjustments to related docs in deplete module files
- retain backwards compatiblity by exporint Operator alias
This commit is contained in:
yardasol 2022-07-30 16:46:31 -05:00
parent 511464b53b
commit 773757246b
8 changed files with 96 additions and 82 deletions

View file

@ -234,7 +234,7 @@ of FPY:
Only applicable to transport-coupled depletion
The method for transport-coupled depletion can be selected through the
``fission_yield_mode`` argument to the :class:`openmc.deplete.Operator`
``fission_yield_mode`` argument to the :class:`openmc.deplete.CoupledOperator`
constructor.
Power Normalization
@ -246,8 +246,8 @@ compute an absolute reaction rate in reactions per second. To do so, the
reaction rates are normalized based on a specified power. A complete
description of how this normalization can be performed is described in
:ref:`usersguide_tally_normalization`. Here, we simply note that the main
depletion class, :class:`openmc.deplete.Operator`, allows the user to choose
one of two methods for estimating the heating rate, including:
depletion class, :class:`openmc.deplete.CoupledOperator`, allows the user to
choose one of two methods for estimating the heating rate, including:
1. Using fixed Q values from a depletion chain file (useful for comparisons to
other codes that use fixed Q values), or
@ -255,4 +255,4 @@ one of two methods for estimating the heating rate, including:
energy-dependent estimate of the true heating rate.
The method for normalization can be chosen through the ``normalization_mode``
argument to the :class:`openmc.deplete.Operator` class.
argument to the :class:`openmc.deplete.CoupledOperator` class.

View file

@ -18,8 +18,8 @@ are:
The former is responsible for obtaining transmuation reaction rates. The latter
is responsible for projecting reaction rates and compositions forward in
calendar time across some step size :math:`\Delta t`, and obtaining new
compositions given a power or power density. The :class:`Operator` class is
provided to obtain reaction rates via tallies through OpenMC's transport
compositions given a power or power density. The :class:`CoupledOperator` class
is provided to obtain reaction rates via tallies through OpenMC's transport
solver, and the :class:`IndependentOperator` class is provided to obtain
reaction rates from cross-section data. Several classes are provided that
implement different time-integration algorithms for depletion calculations,
@ -49,11 +49,11 @@ provided by OpenMC are available using the following classes:
:nosignatures:
:template: mycallable.rst
Operator
CoupledOperator
IndependentOperator
The :class:`Operator` and :class:`IndependentOperator` classes must also have
some knowledge of how nuclides transmute and decay. This is handled by the
The :class:`CoupledOperator` and :class:`IndependentOperator` classes must also
have some knowledge of how nuclides transmute and decay. This is handled by the
:class:`Chain`.
Minimal Example
@ -71,7 +71,7 @@ A minimal example for performing depletion would be:
# Representation of a depletion chain
>>> chain_file = "chain_casl.xml"
>>> operator = openmc.deplete.Operator(
>>> operator = openmc.deplete.CoupledOperator(
... model, chain_file)
# Set up 5 time steps of one day each
@ -177,7 +177,7 @@ with :func:`cram.CRAM48` being the default.
:class:`multiprocessing.pool.Pool` class. If set to ``None`` (default), the
number returned by :func:`os.cpu_count` is used.
The following classes are used to help the :class:`openmc.deplete.Operator`
The following classes are used to help the :class:`openmc.deplete.CoupledOperator`
compute quantities like effective fission yields, reaction rates, and
total system energy.
@ -194,6 +194,8 @@ total system energy.
helpers.FissionYieldCutoffHelper
helpers.FluxCollapseHelper
The :class:`openmc.deplete.IndependentOperator` uses inner class subclassed from
those listed to perform similar calculations.
Intermediate Classes
--------------------

View file

@ -47,17 +47,17 @@ Transport-coupled depletion
This category of operator solves the transport equation to obtain transmutation
reaction rates. At present, the :mod:`openmc.deplete` module offers a single
transport-coupled operator, :class:`openmc.deplete.Operator` (which uses the
OpenMC transport solver), but in principle additional transport-coupled operator
classes based on other transport codes could be implemented and no changes to
the depletion solver itself would be needed. The
:class:`openmc.deplete.Operator` class requires a :class:`~openmc.Model`
transport-coupled operator, :class:`openmc.deplete.CoupledOperator` (which uses
the OpenMC transport solver), but in principle additional transport-coupled
operator classes based on other transport codes could be implemented and no
changes to the depletion solver itself would be needed. The
:class:`openmc.deplete.CoupledOperator` class requires a :class:`~openmc.Model`
instance containing material, geometry, and settings information::
model = openmc.Model()
...
op = openmc.deplete.Operator(model)
op = openmc.deplete.CoupledOperator(model)
Any material that contains a fissionable nuclide is depleted by default, but
this can behavior can be changed with the :attr:`Material.depletable` attribute.
@ -86,11 +86,11 @@ using the :attr:`Material.depletable` attribute::
mat = openmc.Material()
mat.depletable = True
When constructing the :class:`~openmc.deplete.Operator`, you should indicate
that normalization of tally results will be done based on the source rate rather
than a power or power density::
When constructing the :class:`~openmc.deplete.CoupledOperator`, you should
indicate that normalization of tally results will be done based on the source
rate rather than a power or power density::
op = openmc.deplete.Operator(model, normalization_mode='source-rate')
op = openmc.deplete.CoupledOperator(model, normalization_mode='source-rate')
Finally, when creating a depletion integrator, use the ``source_rates`` argument::
@ -109,13 +109,14 @@ Energy Deposition
~~~~~~~~~~~~~~~~~
The default energy deposition mode, ``"fission-q"``, instructs the
:class:`~openmc.deplete.Operator` to normalize reaction rates using the product
of fission reaction rates and fission Q values taken from the depletion chain.
This approach does not consider indirect contributions to energy deposition,
such as neutron heating and energy from secondary photons. In doing this, the
energy deposited during a transport calculation will be lower than expected.
This causes the reaction rates to be over-adjusted to hit the user-specific
power, or power density, leading to an over-depletion of burnable materials.
:class:`~openmc.deplete.CoupledOperator` to normalize reaction rates using the
product of fission reaction rates and fission Q values taken from the depletion
chain. This approach does not consider indirect contributions to energy
deposition, such as neutron heating and energy from secondary photons. In doing
this, the energy deposited during a transport calculation will be lower than
expected. This causes the reaction rates to be over-adjusted to hit the
user-specific power, or power density, leading to an over-depletion of burnable
materials.
There are some remedies. First, the fission Q values can be directly set in a
variety of ways. This requires knowing what the total fission energy release
@ -130,10 +131,10 @@ should be, including indirect components. Some examples are provided below::
# create a modified chain and write it to a new file
chain = openmc.deplete.Chain.from_xml("chain.xml", fission_q)
chain.export_to_xml("chain_mod_q.xml")
op = openmc.deplete.Operator(model, "chain_mod_q.xml")
op = openmc.deplete.CoupledOperator(model, "chain_mod_q.xml")
# alternatively, pass the modified fission Q directly to the operator
op = openmc.deplete.Operator(model, "chain.xml",
op = openmc.deplete.CoupledOperator(model, "chain.xml",
fission_q=fission_q)
@ -141,7 +142,7 @@ A more complete way to model the energy deposition is to use the modified
heating reactions described in :ref:`methods_heating`. These values can be used
to normalize reaction rates instead of using the fission reaction rates with::
op = openmc.deplete.Operator(model, "chain.xml",
op = openmc.deplete.CoupledOperator(model, "chain.xml",
normalization_mode="energy-deposition")
These modified heating libraries can be generated by running the latest version
@ -174,7 +175,7 @@ the next transport step.
This can be countered by instructing the operator to treat repeated instances
of the same material as a unique material definition with::
op = openmc.deplete.Operator(model, chain_file,
op = openmc.deplete.CoupledOperator(model, chain_file,
diff_burnable_mats=True)
For our example problem, this would deplete fuel on the outer region of the

View file

@ -82,7 +82,8 @@ class TransportOperator(ABC):
operator that takes a vector of material compositions and returns an
eigenvalue and reaction rates. This abstract class sets the requirements
for such a transport operator. Users should instantiate
:class:`openmc.deplete.Operator` rather than this class.
:class:`openmc.deplete.CoupledOperator` or
:class:`openmc.deplete.IndependentOperator` rather than this class.
Parameters
----------
@ -220,9 +221,11 @@ class ReactionRateHelper(ABC):
Parameters
----------
n_nucs : int
Number of burnable nuclides tracked by :class:`openmc.deplete.Operator`
Number of burnable nuclides tracked by
:class:`openmc.deplete.abc.TransportOperator`
n_react : int
Number of reactions tracked by :class:`openmc.deplete.Operator`
Number of reactions tracked by
:class:`openmc.deplete.abc.TransportOperator`
Attributes
----------
@ -291,9 +294,9 @@ class NormalizationHelper(ABC):
"""Abstract class for obtaining normalization factor on tallies
This helper class determines how reaction rates calculated by an instance of
:class:`openmc.deplete.Operator` should be normalized for the purpose of
constructing a burnup matrix. Based on the method chosen, the power or
source rate provided by the user, and reaction rates from a
:class:`openmc.deplete.abc.TransportOperator` should be normalized for the
purpose of constructing a burnup matrix. Based on the method chosen, the
power or source rate provided by the user, and reaction rates from a
:class:`ReactionRateHelper`, this class will scale reaction rates to the
correct values.
@ -301,7 +304,7 @@ class NormalizationHelper(ABC):
----------
nuclides : list of str
All nuclides with desired reaction rates. Ordered to be
consistent with :class:`openmc.deplete.Operator`
consistent with :class:`openmc.deplete.abc.TransportOperator`
"""
@ -315,9 +318,9 @@ class NormalizationHelper(ABC):
def prepare(self, chain_nucs, rate_index):
"""Perform work needed to obtain energy produced
This method is called prior to the transport simulations
in :meth:`openmc.deplete.Operator.initial_condition`. Only used for
energy-based normalization.
This method is called prior to calculating the reaction rates
in :meth:`openmc.deplete.abc.TransportOperator.initial_condition`. Only
used for energy-based normalization.
Parameters
----------
@ -430,7 +433,7 @@ class FissionYieldHelper(ABC):
def unpack():
"""Unpack tally data prior to compute fission yields.
Called after a :meth:`openmc.deplete.Operator.__call__`
Called after a :meth:`openmc.deplete.abc.TransportOperator.__call__`
routine during the normalization of reaction rates.
Not necessary for all subclasses to implement, unless tallies
@ -451,7 +454,7 @@ class FissionYieldHelper(ABC):
mat_indexes : iterable of int
Indices of tallied materials that will have their fission
yields computed by this helper. Necessary as the
:class:`openmc.deplete.Operator` that uses this helper
:class:`openmc.deplete.CoupledOperator` that uses this helper
may only burn a subset of all materials when running
in parallel mode.
"""
@ -463,14 +466,15 @@ class FissionYieldHelper(ABC):
----------
nuclides : iterable of str
Nuclides with non-zero densities from the
:class:`openmc.deplete.Operator`
:class:`openmc.deplete.abc.TransportOperator`
Returns
-------
nuclides : list of str
Union of nuclides that the :class:`openmc.deplete.Operator`
says have non-zero densities at this stage and those that
have yield data. Sorted by nuclide name
Union of nuclides that the
:class:`openmc.deplete.abc.TransportOperator` says have non-zero
densities at this stage and those that have yield data. Sorted by
nuclide name
"""
return sorted(self._chain_set & set(nuclides))
@ -484,7 +488,7 @@ class FissionYieldHelper(ABC):
Parameters
----------
operator : openmc.deplete.TransportOperator
operator : openmc.deplete.abc.TransportOperator
Operator with a depletion chain
kwargs: optional
Additional keyword arguments to be used in constuction
@ -505,7 +509,7 @@ class Integrator(ABC):
_params = r"""
Parameters
----------
operator : openmc.deplete.TransportOperator
operator : openmc.deplete.abc.TransportOperator
Operator to perform transport simulations
timesteps : iterable of float or iterable of tuple
Array of timesteps. Note that values are not cumulative. The units are
@ -548,7 +552,7 @@ class Integrator(ABC):
Attributes
----------
operator : openmc.deplete.TransportOperator
operator : openmc.deplete.abc.TransportOperator
Operator to perform transport simulations
chain : openmc.deplete.Chain
Depletion chain
@ -843,7 +847,7 @@ class SIIntegrator(Integrator):
_params = r"""
Parameters
----------
operator : openmc.deplete.TransportOperator
operator : openmc.deplete.abc.TransportOperator
The operator object to simulate on.
timesteps : iterable of float or iterable of tuple
Array of timesteps. Note that values are not cumulative. The units are
@ -889,7 +893,7 @@ class SIIntegrator(Integrator):
Attributes
----------
operator : openmc.deplete.TransportOperator
operator : openmc.deplete.abc.TransportOperator
Operator to perform transport simulations
chain : openmc.deplete.Chain
Depletion chain

View file

@ -264,7 +264,8 @@ class Chain:
requires a list of ENDF incident neutron, decay, and neutron fission product
yield sublibrary files. The depletion chain used during a depletion
simulation is indicated by either an argument to
:class:`openmc.deplete.Operator` or through the
:class:`openmc.deplete.CoupledOperator` or
:class:`openmc.deplete.IndependentOperator`, or through the
``depletion_chain`` item in the :envvar:`OPENMC_CROSS_SECTIONS`
environment variable.

View file

@ -68,7 +68,7 @@ class TalliedFissionYieldHelper(FissionYieldHelper):
mat_indexes : iterable of int
Indices of tallied materials that will have their fission
yields computed by this helper. Necessary as the
:class:`openmc.deplete.Operator` that uses this helper
:class:`openmc.deplete.CoupledOperator` that uses this helper
may only burn a subset of all materials when running
in parallel mode.
"""
@ -133,9 +133,11 @@ class DirectReactionRateHelper(ReactionRateHelper):
Parameters
----------
n_nucs : int
Number of burnable nuclides tracked by :class:`openmc.deplete.Operator`
Number of burnable nuclides tracked by
:class:`openmc.deplete.CoupledOperator`
n_react : int
Number of reactions tracked by :class:`openmc.deplete.Operator`
Number of reactions tracked by an instance of
:class:`openmc.deplete.CoupledOperator`
Attributes
----------
@ -217,9 +219,10 @@ class FluxCollapseHelper(ReactionRateHelper):
Parameters
----------
n_nucs : int
Number of burnable nuclides tracked by :class:`openmc.deplete.Operator`
Number of burnable nuclides tracked by
:class:`openmc.deplete.CoupledOperator`
n_react : int
Number of reactions tracked by :class:`openmc.deplete.Operator`
Number of reactions tracked by :class:`openmc.deplete.CoupledOperator`
energies : iterable of float
Energy group boundaries for flux spectrum in [eV]
reactions : iterable of str
@ -385,7 +388,7 @@ class ChainFissionHelper(EnergyNormalizationHelper):
----------
nuclides : list of str
All nuclides with desired reaction rates. Ordered to be
consistent with :class:`openmc.deplete.Operator`
consistent with :class:`openmc.deplete.CoupledOperator`
energy : float
Total energy [J/s/source neutron] produced in a transport simulation.
Updated in the material iteration with :meth:`update`.
@ -637,7 +640,7 @@ class FissionYieldCutoffHelper(TalliedFissionYieldHelper):
that occurred below ``cutoff``. The number
of materials in the first axis corresponds
to the number of materials burned by the
:class:`openmc.deplete.Operator`
:class:`openmc.deplete.CoupledOperator`
"""
def __init__(self, chain_nuclides, n_bmats, cutoff=112.0,
@ -694,7 +697,7 @@ class FissionYieldCutoffHelper(TalliedFissionYieldHelper):
Parameters
----------
operator : openmc.deplete.Operator
operator : openmc.deplete.CoupledOperator
Operator with a chain and burnable materials
kwargs:
Additional keyword arguments to be used in construction
@ -720,7 +723,7 @@ class FissionYieldCutoffHelper(TalliedFissionYieldHelper):
mat_indexes : iterable of int
Indices of tallied materials that will have their fission
yields computed by this helper. Necessary as the
:class:`openmc.deplete.Operator` that uses this helper
:class:`openmc.deplete.CoupledOperator` that uses this helper
may only burn a subset of all materials when running
in parallel mode.
"""
@ -845,7 +848,7 @@ class AveragedFissionYieldHelper(TalliedFissionYieldHelper):
mat_indexes : iterable of int
Indices of tallied materials that will have their fission
yields computed by this helper. Necessary as the
:class:`openmc.deplete.Operator` that uses this helper
:class:`openmc.deplete.CoupledOperator` that uses this helper
may only burn a subset of all materials when running
in parallel mode.
"""
@ -958,7 +961,7 @@ class AveragedFissionYieldHelper(TalliedFissionYieldHelper):
Parameters
----------
operator : openmc.deplete.TransportOperator
operator : openmc.deplete.CoupledOperator
Operator with a depletion chain
kwargs :
Additional keyword arguments to be used in construction

View file

@ -30,7 +30,7 @@ from .helpers import (
SourceRateHelper, FluxCollapseHelper)
__all__ = ["Operator", "OperatorResult"]
__all__ = ["CoupledOperator", "Operator", "OperatorResult"]
def _find_cross_sections(model):
@ -56,13 +56,13 @@ def _find_cross_sections(model):
return cross_sections
class Operator(OpenMCOperator):
"""OpenMC transport operator for depletion.
class CoupledOperator(OpenMCOperator):
"""Transport-coupled operator for depletion.
Instances of this class can be used to perform depletion using OpenMC as the
transport operator. Normally, a user needn't call methods of this class
directly. Instead, an instance of this class is passed to an integrator
class, such as :class:`openmc.deplete.CECMIntegrator`.
Instances of this class can be used to perform transport-coupled depletion
using OpenMC's transport solver. Normally, a user needn't call methods of
this class directly. Instead, an instance of this class is passed to an
integrator class, such as :class:`openmc.deplete.CECMIntegrator`.
.. versionchanged:: 0.13.0
The geometry and settings parameters have been replaced with a
@ -193,11 +193,11 @@ class Operator(OpenMCOperator):
reduce_chain=False, reduce_chain_level=None):
# check for old call to constructor
if isinstance(model, openmc.Geometry):
msg = "As of version 0.13.0 openmc.deplete.Operator requires an " \
"openmc.Model object rather than the openmc.Geometry and " \
"openmc.Settings parameters. Please use the geometry and " \
"settings objects passed here to create a model with which " \
"to generate the depletion Operator."
msg = "As of version 0.13.0 openmc.deplete.CoupledOperator " \
"requires an openmc.Model object rather than the " \
"openmc.Geometry and openmc.Settings parameters. Please use " \
"the geometry and settings objects passed here to create a " \
" model with which to generate the depletion Operator."
raise TypeError(msg)
# Determine cross sections / depletion chain
@ -516,3 +516,6 @@ class Operator(OpenMCOperator):
"""Finalize a depletion simulation and release resources."""
if self.cleanup_when_done:
openmc.lib.finalize()
# Retain deprecated name for the time being
Operator = CoupledOperator

View file

@ -81,9 +81,9 @@ class Results(list):
.. note::
Initial values for some isotopes that do not appear in
initial concentrations may be non-zero, depending on the
value of the :attr:`openmc.deplete.Operator.dilute_initial`
attribute. The :class:`openmc.deplete.Operator` class adds isotopes
according to this setting, which can be set to zero.
value of the :attr:`openmc.deplete.CoupledOperator.dilute_initial`
attribute. The :class:`openmc.deplete.CoupledOperator` class adds
isotopes according to this setting, which can be set to zero.
Parameters
----------
@ -145,8 +145,8 @@ class Results(list):
Initial values for some isotopes that do not appear in
initial concentrations may be non-zero, depending on the
value of :class:`openmc.deplete.Operator` ``dilute_initial``
The :class:`openmc.deplete.Operator` adds isotopes according
value of :class:`openmc.deplete.CoupledOperator` ``dilute_initial``
The :class:`openmc.deplete.CoupledOperator` adds isotopes according
to this setting, which can be set to zero.
Parameters