mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 05:05:30 -04:00
using reduce chain level to remove need for reduce chain (#3377)
Co-authored-by: Jon Shimwell <jon@proximafusion.com> Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
5dd6ff6527
commit
820648daee
4 changed files with 16 additions and 37 deletions
|
|
@ -154,15 +154,9 @@ class CoupledOperator(OpenMCOperator):
|
|||
options.
|
||||
|
||||
.. versionadded:: 0.12.1
|
||||
reduce_chain : bool, optional
|
||||
If True, use :meth:`openmc.deplete.Chain.reduce` to reduce the
|
||||
depletion chain up to ``reduce_chain_level``.
|
||||
|
||||
.. versionadded:: 0.12
|
||||
reduce_chain_level : int, optional
|
||||
Depth of the search when reducing the depletion chain. Only used
|
||||
if ``reduce_chain`` evaluates to true. The default value of
|
||||
``None`` implies no limit on the depth.
|
||||
Depth of the search when reducing the depletion chain. The default
|
||||
value of ``None`` implies no limit on the depth.
|
||||
|
||||
.. versionadded:: 0.12
|
||||
diff_volume_method : str
|
||||
|
|
@ -214,7 +208,7 @@ class CoupledOperator(OpenMCOperator):
|
|||
normalization_mode="fission-q", fission_q=None,
|
||||
fission_yield_mode="constant", fission_yield_opts=None,
|
||||
reaction_rate_mode="direct", reaction_rate_opts=None,
|
||||
reduce_chain=False, reduce_chain_level=None):
|
||||
reduce_chain_level=None):
|
||||
|
||||
# check for old call to constructor
|
||||
if isinstance(model, openmc.Geometry):
|
||||
|
|
@ -270,7 +264,6 @@ class CoupledOperator(OpenMCOperator):
|
|||
diff_volume_method=diff_volume_method,
|
||||
fission_q=fission_q,
|
||||
helper_kwargs=helper_kwargs,
|
||||
reduce_chain=reduce_chain,
|
||||
reduce_chain_level=reduce_chain_level)
|
||||
|
||||
def _differentiate_burnable_mats(self):
|
||||
|
|
|
|||
|
|
@ -66,13 +66,9 @@ class IndependentOperator(OpenMCOperator):
|
|||
Dictionary of nuclides and their fission Q values [eV]. If not given,
|
||||
values will be pulled from the ``chain_file``. Only applicable if
|
||||
``"normalization_mode" == "fission-q"``.
|
||||
reduce_chain : bool, optional
|
||||
If True, use :meth:`openmc.deplete.Chain.reduce` to reduce the depletion
|
||||
chain up to ``reduce_chain_level``.
|
||||
reduce_chain_level : int, optional
|
||||
Depth of the search when reducing the depletion chain. Only used if
|
||||
``reduce_chain`` evaluates to true. The default value of ``None``
|
||||
implies no limit on the depth.
|
||||
Depth of the search when reducing the depletion chain. The default
|
||||
value of ``None`` implies no limit on the depth.
|
||||
fission_yield_opts : dict of str to option, optional
|
||||
Optional arguments to pass to the
|
||||
:class:`openmc.deplete.helpers.FissionYieldHelper` object. Will be
|
||||
|
|
@ -119,7 +115,6 @@ class IndependentOperator(OpenMCOperator):
|
|||
normalization_mode='fission-q',
|
||||
fission_q=None,
|
||||
prev_results=None,
|
||||
reduce_chain=False,
|
||||
reduce_chain_level=None,
|
||||
fission_yield_opts=None):
|
||||
# Validate micro-xs parameters
|
||||
|
|
@ -157,7 +152,6 @@ class IndependentOperator(OpenMCOperator):
|
|||
prev_results=prev_results,
|
||||
fission_q=fission_q,
|
||||
helper_kwargs=helper_kwargs,
|
||||
reduce_chain=reduce_chain,
|
||||
reduce_chain_level=reduce_chain_level)
|
||||
|
||||
@classmethod
|
||||
|
|
@ -170,7 +164,6 @@ class IndependentOperator(OpenMCOperator):
|
|||
normalization_mode='fission-q',
|
||||
fission_q=None,
|
||||
prev_results=None,
|
||||
reduce_chain=False,
|
||||
reduce_chain_level=None,
|
||||
fission_yield_opts=None):
|
||||
"""
|
||||
|
|
@ -206,13 +199,9 @@ class IndependentOperator(OpenMCOperator):
|
|||
applicable if ``"normalization_mode" == "fission-q"``.
|
||||
prev_results : Results, optional
|
||||
Results from a previous depletion calculation.
|
||||
reduce_chain : bool, optional
|
||||
If True, use :meth:`openmc.deplete.Chain.reduce` to reduce the
|
||||
depletion chain up to ``reduce_chain_level``. Default is False.
|
||||
reduce_chain_level : int, optional
|
||||
Depth of the search when reducing the depletion chain. Only used
|
||||
if ``reduce_chain`` evaluates to true. The default value of
|
||||
``None`` implies no limit on the depth.
|
||||
Depth of the search when reducing the depletion chain. The default
|
||||
value of ``None`` implies no limit on the depth.
|
||||
fission_yield_opts : dict of str to option, optional
|
||||
Optional arguments to pass to the
|
||||
:class:`openmc.deplete.helpers.FissionYieldHelper` class. Will be
|
||||
|
|
@ -232,7 +221,6 @@ class IndependentOperator(OpenMCOperator):
|
|||
normalization_mode=normalization_mode,
|
||||
fission_q=fission_q,
|
||||
prev_results=prev_results,
|
||||
reduce_chain=reduce_chain,
|
||||
reduce_chain_level=reduce_chain_level,
|
||||
fission_yield_opts=fission_yield_opts)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from warnings import warn
|
|||
import numpy as np
|
||||
|
||||
import openmc
|
||||
from openmc.checkvalue import check_value
|
||||
from openmc.checkvalue import check_value, check_type, check_greater_than
|
||||
from openmc.exceptions import DataError
|
||||
from openmc.mpi import comm
|
||||
from .abc import TransportOperator, OperatorResult
|
||||
|
|
@ -49,13 +49,9 @@ class OpenMCOperator(TransportOperator):
|
|||
Dictionary of nuclides and their fission Q values [eV].
|
||||
helper_kwargs : dict
|
||||
Keyword arguments for helper classes
|
||||
reduce_chain : bool, optional
|
||||
If True, use :meth:`openmc.deplete.Chain.reduce()` to reduce the
|
||||
depletion chain up to ``reduce_chain_level``.
|
||||
reduce_chain_level : int, optional
|
||||
Depth of the search when reducing the depletion chain. Only used
|
||||
if ``reduce_chain`` evaluates to true. The default value of
|
||||
``None`` implies no limit on the depth.
|
||||
Depth of the search when reducing the depletion chain. The default
|
||||
value of ``None`` implies no limit on the depth.
|
||||
|
||||
diff_volume_method : str
|
||||
Specifies how the volumes of the new materials should be found. Default
|
||||
|
|
@ -107,7 +103,6 @@ class OpenMCOperator(TransportOperator):
|
|||
diff_volume_method='divide equally',
|
||||
fission_q=None,
|
||||
helper_kwargs=None,
|
||||
reduce_chain=False,
|
||||
reduce_chain_level=None):
|
||||
|
||||
# If chain file was not specified, try to get it from global config
|
||||
|
|
@ -126,10 +121,13 @@ class OpenMCOperator(TransportOperator):
|
|||
|
||||
check_value('diff volume method', diff_volume_method,
|
||||
{'divide equally', 'match cell'})
|
||||
if reduce_chain_level:
|
||||
check_type('reduce_chain_level', reduce_chain_level, int)
|
||||
check_greater_than('reduce_chain_level', reduce_chain_level, 0)
|
||||
self.diff_volume_method = diff_volume_method
|
||||
|
||||
# Reduce the chain to only those nuclides present
|
||||
if reduce_chain:
|
||||
if reduce_chain_level is not None:
|
||||
init_nuclides = set()
|
||||
for material in self.materials:
|
||||
if not material.depletable:
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ def test_deplete(run_in_tmpdir, pin_model_attributes, mpi_intracomm):
|
|||
# In this test we first run without pre-initializing the shared library
|
||||
# data and then compare. Then we repeat with the C API already initialized
|
||||
# and make sure we get the same answer
|
||||
test_model.deplete([1e6], 'predictor', final_step=False,
|
||||
test_model.deplete(timesteps=[1e6], method='predictor', final_step=False,
|
||||
operator_kwargs=op_kwargs,
|
||||
power=1., output=False)
|
||||
# Get the new Xe136 and U235 atom densities
|
||||
|
|
@ -482,7 +482,7 @@ def test_deplete(run_in_tmpdir, pin_model_attributes, mpi_intracomm):
|
|||
|
||||
# Now we can re-run with the pre-initialized API
|
||||
test_model.init_lib(output=False, intracomm=mpi_intracomm)
|
||||
test_model.deplete([1e6], 'predictor', final_step=False,
|
||||
test_model.deplete(timesteps=[1e6], method='predictor', final_step=False,
|
||||
operator_kwargs=op_kwargs,
|
||||
power=1., output=False)
|
||||
# Get the new Xe136 and U235 atom densities
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue