mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Allow user control over Operator.dilute_initial
Users can now pass dilute_initial as an input argument into the Operator, and directly set Operator.dilute_initial. Documentation was updated to include units on the initial default concentration, which is 1000 atoms per cubic centimeter. The user is allowed to set this value to zero. Notes have been added to ResultsList.get_atoms and get_reaction_rate methods, indicating why there may be non-zero values when pulling data for isotopes not initially present. A similar note was added to the depletion_results.h5 io format file. Closes #1288
This commit is contained in:
parent
b4b063482e
commit
918340a3af
4 changed files with 58 additions and 14 deletions
|
|
@ -44,3 +44,10 @@ The current version of the depletion results file format is 1.0.
|
|||
**/reactions/<name>/**
|
||||
|
||||
: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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue