From d67d0cd0f9deb79d5627fa79bc985854d89f5d03 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Mar 2020 18:11:54 -0400 Subject: [PATCH] Allow Operator to reduce depletion chain from geometry A new parameter, reduce_chain, can be used to instruct the operator to create a smaller depletion chain. The geometry is used to find all nuclides in burnable materials. The argument can be a boolean, or a non-negative integer. A value of True indicates no depth for following the paths, while an integer can be used to directly specify the depth. --- openmc/deplete/operator.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/openmc/deplete/operator.py b/openmc/deplete/operator.py index 8eb033783f..2572150012 100644 --- a/openmc/deplete/operator.py +++ b/openmc/deplete/operator.py @@ -113,6 +113,12 @@ class Operator(TransportOperator): ``fission_yield_mode``. Will be passed directly on to the helper. Passing a value of None will use the defaults for the associated helper. + reduce_chain : bool or int, optional + If ``True`` or an integer, create a reduced depletion chain by + following transmuation paths for isotopes in burnable materials. + A value of ``True`` implies to follow all paths to completion, + while a non-negative integer indicates the depth. See + :meth:`openmc.deplete.Chain.reduce` Attributes ---------- @@ -158,7 +164,8 @@ class Operator(TransportOperator): def __init__(self, geometry, settings, chain_file=None, prev_results=None, diff_burnable_mats=False, energy_mode="fission-q", fission_q=None, dilute_initial=1.0e3, - fission_yield_mode="constant", fission_yield_opts=None): + fission_yield_mode="constant", fission_yield_opts=None, + reduce_chain=False): if fission_yield_mode not in self._fission_helpers: raise KeyError( "fission_yield_mode must be one of {}, not {}".format( @@ -179,6 +186,17 @@ class Operator(TransportOperator): self.geometry = geometry self.diff_burnable_mats = diff_burnable_mats + # Reduce the chain before we create more materials + if reduce_chain is not False: + all_isotopes = set() + for material in geometry.get_all_materials().values(): + if not material.depletable: + continue + for name, _dens_percent, _dens_type in material.nuclides: + all_isotopes.add(name) + level = None if reduce_chain is True else reduce_chain + self.chain = self.chain.reduce(all_isotopes, level) + # Differentiate burnable materials with multiple instances if self.diff_burnable_mats: self._differentiate_burnable_mats()