diff --git a/docs/source/io_formats/depletion_results.rst b/docs/source/io_formats/depletion_results.rst index 3c782b1d9..de28b0477 100644 --- a/docs/source/io_formats/depletion_results.rst +++ b/docs/source/io_formats/depletion_results.rst @@ -44,3 +44,10 @@ The current version of the depletion results file format is 1.0. **/reactions//** :Attributes: - **index** (*int*) -- Index user in results for this reaction + +.. note:: + + The reaction rates for some isotopes not originally present may + be non-zero, but should be negligible compared to other atoms. + This can be controlled by changing the + :class:`openmc.deplete.Operator` ``dilute_initial`` attribute. diff --git a/openmc/deplete/abc.py b/openmc/deplete/abc.py index c5c086854..6b09543ae 100644 --- a/openmc/deplete/abc.py +++ b/openmc/deplete/abc.py @@ -10,11 +10,12 @@ from pathlib import Path from abc import ABC, abstractmethod from xml.etree import ElementTree as ET from warnings import warn +from numbers import Real from numpy import nonzero, empty from openmc.data import DataLibrary, JOULE_PER_EV -from openmc.checkvalue import check_type +from openmc.checkvalue import check_type, check_greater_than from .chain import Chain OperatorResult = namedtuple('OperatorResult', ['k', 'rates']) @@ -55,17 +56,21 @@ class TransportOperator(ABC): fission_q : dict, optional Dictionary of nuclides and their fission Q values [eV]. If not given, values will be pulled from the ``chain_file``. + dilute_initial : float, optional + Initial atom density [atoms/cm^3] to add for nuclides that are zero + in initial condition to ensure they exist in the decay chain. + Only done for nuclides with reaction rates. + Defaults to 1.0e3. Attributes ---------- dilute_initial : float - Initial atom density to add for nuclides that are zero in initial - condition to ensure they exist in the decay chain. Only done for - nuclides with reaction rates. Defaults to 1.0e3. - + Initial atom density [atoms/cm^3] to add for nuclides that are zero + in initial condition to ensure they exist in the decay chain. + Only done for nuclides with reaction rates. """ - def __init__(self, chain_file=None, fission_q=None): - self.dilute_initial = 1.0e3 + def __init__(self, chain_file=None, fission_q=None, dilute_initial=1.0e3): + self.dilute_initial = dilute_initial self.output_dir = '.' # Read depletion chain @@ -89,6 +94,17 @@ class TransportOperator(ABC): FutureWarning) self.chain = Chain.from_xml(chain_file, fission_q) + @property + def dilute_initial(self): + """Initial atom density for nuclides with zero initial concentration""" + return self._dilute_initial + + @dilute_initial.setter + def dilute_initial(self, value): + check_type("dilute_initial", value, Real) + check_greater_than("dilute_initial", value, 0.0, equality=True) + self._dilute_initial = value + @abstractmethod def __call__(self, vec, print_out=True): """Runs a simulation. diff --git a/openmc/deplete/operator.py b/openmc/deplete/operator.py index bb3c96e4f..388317e07 100644 --- a/openmc/deplete/operator.py +++ b/openmc/deplete/operator.py @@ -76,6 +76,11 @@ class Operator(TransportOperator): fission_q : dict, optional Dictionary of nuclides and their fission Q values [eV]. If not given, values will be pulled from the ``chain_file``. + dilute_initial : float, optional + Initial atom density [atoms/cm^3] to add for nuclides that are zero + in initial condition to ensure they exist in the decay chain. + Only done for nuclides with reaction rates. + Defaults to 1.0e3. Attributes ---------- @@ -84,9 +89,9 @@ class Operator(TransportOperator): settings : openmc.Settings OpenMC settings object dilute_initial : float - Initial atom density to add for nuclides that are zero in initial - condition to ensure they exist in the decay chain. Only done for - nuclides with reaction rates. Defaults to 1.0e3. + Initial atom density [atoms/cm^3] to add for nuclides that + are zero in initial condition to ensure they exist in the decay + chain. Only done for nuclides with reaction rates. output_dir : pathlib.Path Path to output directory to save results. round_number : bool @@ -110,11 +115,11 @@ class Operator(TransportOperator): Results from a previous depletion calculation diff_burnable_mats : bool Whether to differentiate burnable materials with multiple instances - """ def __init__(self, geometry, settings, chain_file=None, prev_results=None, - diff_burnable_mats=False, fission_q=None): - super().__init__(chain_file, fission_q) + diff_burnable_mats=False, fission_q=None, + dilute_initial=1.0e3): + super().__init__(chain_file, fission_q, dilute_initial) self.round_number = False self.settings = settings self.geometry = geometry diff --git a/openmc/deplete/results_list.py b/openmc/deplete/results_list.py index 79203a631..0ce5b0158 100644 --- a/openmc/deplete/results_list.py +++ b/openmc/deplete/results_list.py @@ -26,7 +26,15 @@ class ResultsList(list): self.append(Results.from_hdf5(fh, i)) def get_atoms(self, mat, nuc): - """Get nuclide concentration over time from a single material + """Get number of nuclides over time from a single material + + .. note:: + + 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 + to this setting, which can be set to zero. Parameters ---------- @@ -56,6 +64,14 @@ class ResultsList(list): def get_reaction_rate(self, mat, nuc, rx): """Get reaction rate in a single material/nuclide over time + .. note:: + + 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 + to this setting, which can be set to zero. + Parameters ---------- mat : str