Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
41653f0
first commit to new branch
church89 Aug 23, 2023
1d3f0ca
batchwise first commits
church89 Sep 4, 2023
f561da1
update unit test
church89 Sep 5, 2023
652df2b
add test unit
church89 Sep 5, 2023
c08b762
unit test update
church89 Sep 6, 2023
7b27002
further improvements to the module
church89 Sep 12, 2023
0910bf2
add unit and regression tests
church89 Sep 12, 2023
2cd774e
Merge pull request #10 from openmc-dev/develop
church89 Sep 12, 2023
562baad
add missing docstrings
church89 Sep 13, 2023
7643aaf
remove unused import
church89 Sep 13, 2023
1777cee
add missing returns
church89 Sep 13, 2023
6eb6651
fix typo
church89 Sep 13, 2023
42b8e3d
Merge pull request #11 from openmc-dev/develop
church89 Sep 14, 2023
2d48f17
prevent to openmc batchwise_root when to there
church89 Sep 14, 2023
d56fb98
Apply suggestions from code review
church89 Feb 5, 2024
5e2023a
address comments by @drewejohnson
church89 Feb 5, 2024
4a2788e
fix some docstrings
church89 Feb 6, 2024
3110e45
reformatted with black
church89 Feb 6, 2024
a4f1f16
refactoring of _search_for_keff method
church89 Feb 6, 2024
0c804dd
fix some spelling typos
church89 Feb 6, 2024
38ed171
first commit to new branch
church89 Aug 23, 2023
cea8801
resolve conflicts
church89 Feb 7, 2024
7138d2d
update unit test
church89 Sep 5, 2023
872fa81
add test unit
church89 Sep 5, 2023
c16bece
unit test update
church89 Sep 6, 2023
643a75f
further improvements to the module
church89 Sep 12, 2023
94abad5
add unit and regression tests
church89 Sep 12, 2023
688631c
add missing docstrings
church89 Sep 13, 2023
325969f
remove unused import
church89 Sep 13, 2023
5d6e991
add missing returns
church89 Sep 13, 2023
85a1f35
fix typo
church89 Sep 13, 2023
d69a8a8
prevent to openmc batchwise_root when to there
church89 Sep 14, 2023
13ee2e3
Apply suggestions from code review
church89 Feb 5, 2024
1731fda
address comments by @drewejohnson
church89 Feb 5, 2024
e8c36f6
fix some docstrings
church89 Feb 6, 2024
e4c0ad2
reformatted with black
church89 Feb 6, 2024
f1213a4
refactoring of _search_for_keff method
church89 Feb 6, 2024
12a988d
fix some spelling typos
church89 Feb 6, 2024
ad8c7ed
fix conflicts
church89 Feb 7, 2024
ef4fe68
missing underscore
church89 Feb 7, 2024
1aad455
add batchwise get method and update unit test
church89 Feb 12, 2024
f3dfdf8
Apply suggestions from code review
church89 Mar 14, 2024
9d6c5be
address comments by @drewejohnson
church89 Mar 14, 2024
a4b44ed
address more comments by @drewejohnson
church89 Mar 15, 2024
0a2933c
replaced batchwise nomenclature with reactivity_control one
church89 Mar 15, 2024
0ccc75a
update regression reference result files
church89 Mar 15, 2024
da184bb
few fixes
church89 Mar 18, 2024
64543ff
fix unit test failing
church89 Mar 18, 2024
9328e5b
explicit path argument in SIIntegrator step result save method, since…
church89 Mar 19, 2024
a4731ab
add reactivity control restarting condition to integrator class
church89 Mar 19, 2024
49191d4
Merge branch 'develop' into batchwise_pr
church89 Mar 20, 2024
ee13d16
remove unused index argumnet in restart method to comply with latest …
church89 Mar 20, 2024
12a1e70
make sure cell attribute vector maintain initial coordinates
church89 Mar 21, 2024
f67b231
make sure bracket type is an array and apply black code style
church89 Mar 21, 2024
06366b5
fix failing regression test
church89 Mar 21, 2024
fbf91c4
update reference result files
church89 Mar 21, 2024
21e1ac6
change warning message
church89 Mar 26, 2024
6ad6ea0
restore check conditions in adaptive search_for_keff routine
church89 Apr 8, 2024
efc1f61
made ReactivityControllers settable through the integrator
church89 Apr 16, 2024
75ca1f2
Merge pull request #31 from openmsr/reactivity_control
church89 Apr 16, 2024
d2fa7a0
extend use of paramteric geometry to lattice and not only universe
church89 May 7, 2024
7583f78
implement suggested changes to reactivity control classes
church89 Jun 5, 2024
fa13a81
update tests
church89 Jun 6, 2024
c3a6705
Merge pull request #32 from openmsr/reactivity_control_abstrac
church89 Jun 6, 2024
e7c15cf
add forgotten argument to StepResult save method
church89 Jun 6, 2024
4f988cf
Merge remote-tracking branch 'openmsr/add_path_to_step_res' into batc…
church89 Jun 6, 2024
f576e87
Merge branch 'develop' into batchwise_pr
church89 Jun 6, 2024
3ed3071
Merge pull request #44 from openmc-dev/develop
church89 Mar 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions openmc/deplete/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .results import *
from .integrators import *
from .transfer_rates import *
from .reactivity_control import *
from . import abc
from . import cram
from . import helpers
75 changes: 67 additions & 8 deletions openmc/deplete/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import numpy as np
from uncertainties import ufloat

from openmc.checkvalue import check_type, check_greater_than, PathLike
from openmc.checkvalue import check_value, check_type, check_greater_than, PathLike
from openmc.mpi import comm
from openmc.utility_funcs import change_directory
from openmc import Material
Expand All @@ -30,7 +30,12 @@
from .pool import deplete
from .reaction_rates import ReactionRates
from .transfer_rates import TransferRates

from openmc import Material, Cell
from .reactivity_control import (
ReactivityController,
CellReactivityController,
MaterialReactivityController
)

__all__ = [
"OperatorResult", "TransportOperator",
Expand Down Expand Up @@ -608,6 +613,9 @@ class Integrator(ABC):

transfer_rates : openmc.deplete.TransferRates
Instance of TransferRates class to perform continuous transfer during depletion
reactivity_control : openmc.deplete.ReactivityController
Instance of ReactivityController class to perform reactivity control during
transport-depletion simulation.

.. versionadded:: 0.14.0

Expand Down Expand Up @@ -686,6 +694,7 @@ def __init__(
self.source_rates = np.asarray(source_rates)

self.transfer_rates = None
self._reactivity_control = None

if isinstance(solver, str):
# Delay importing of cram module, which requires this file
Expand Down Expand Up @@ -731,6 +740,15 @@ def solver(self, func):

self._solver = func

@property
def reactivity_control(self):
return self._reactivity_control

@reactivity_control.setter
def reactivity_control(self, reactivity_control):
check_type('reactivity control', reactivity_control, ReactivityController)
self._reactivity_control = reactivity_control

def _timed_deplete(self, n, rates, dt, matrix_func=None):
start = time.time()
results = deplete(
Expand Down Expand Up @@ -818,6 +836,13 @@ def _get_start_data(self):
return (self.operator.prev_res[-1].time[-1],
len(self.operator.prev_res) - 1)

def _get_bos_from_reactivity_control(self, step_index, bos_conc):
"""Get BOS from reactivity control."""
x = deepcopy(bos_conc)
# Get new vector after keff criticality control
x, root = self._reactivity_control.search_for_keff(x, step_index)
return x, root

def integrate(
self,
final_step: bool = True,
Expand Down Expand Up @@ -852,10 +877,18 @@ def integrate(

# Solve transport equation (or obtain result from restart)
if i > 0 or self.operator.prev_res is None:
# Update geometry/material according to reactivity control
if self._reactivity_control is not None and source_rate != 0.0:
n, root = self._get_bos_from_reactivity_control(i, n)
else:
root = None
n, res = self._get_bos_data_from_operator(i, source_rate, n)
else:
n, res = self._get_bos_data_from_restart(source_rate, n)

if self._reactivity_control:
root = self.operator.prev_res[-1].reac_cont
else:
root = None
# Solve Bateman equations over time interval
proc_time, n_list, res_list = self(n, res.rates, dt, source_rate, i)

Expand All @@ -865,9 +898,8 @@ def integrate(

# Remove actual EOS concentration for next step
n = n_list.pop()

StepResult.save(self.operator, n_list, res_list, [t, t + dt],
source_rate, self._i_res + i, proc_time, path)
source_rate, self._i_res + i, proc_time, root, path)

t += dt

Expand All @@ -877,9 +909,13 @@ def integrate(
# solve)
if output and final_step and comm.rank == 0:
print(f"[openmc.deplete] t={t} (final operator evaluation)")
if self._reactivity_control is not None and source_rate != 0.0:
n, root = self._get_bos_from_reactivity_control(i+1, n)
else:
root = None
res_list = [self.operator(n, source_rate if final_step else 0.0)]
StepResult.save(self.operator, [n], res_list, [t, t],
source_rate, self._i_res + len(self), proc_time, path)
source_rate, self._i_res + len(self), proc_time, root, path)
self.operator.write_bos_data(len(self) + self._i_res)

self.operator.finalize()
Expand Down Expand Up @@ -918,6 +954,29 @@ def add_transfer_rate(
self.transfer_rates.set_transfer_rate(material, components, transfer_rate,
transfer_rate_units, destination_material)

def add_reactivity_control(
self,
obj: Union[Cell, Material],
**kwargs):
"""Add pre-defined Cell based or Material bases reactivity control to
integrator scheme.

Parameters
----------
obj : openmc.Cell or openmc.Material
Cell or Material identifier to where add reactivity control
**kwargs
keyword arguments that are passed to the specific ReactivityController
class.

"""
if isinstance(obj, Cell):
reactivity_control = CellReactivityController
elif isinstance(obj, Material):
reactivity_control = MaterialReactivityController
self._reactivity_control = reactivity_control.from_params(obj,
self.operator, **kwargs)

@add_params
class SIIntegrator(Integrator):
r"""Abstract class for the Stochastic Implicit Euler integrators
Expand Down Expand Up @@ -1090,13 +1149,13 @@ def integrate(
n = n_list.pop()

StepResult.save(self.operator, n_list, res_list, [t, t + dt],
p, self._i_res + i, proc_time, path)
p, self._i_res + i, proc_time, path=path)

t += dt

# No final simulation for SIE, use last iteration results
StepResult.save(self.operator, [n], [res_list[-1]], [t, t],
p, self._i_res + len(self), proc_time, path)
p, self._i_res + len(self), proc_time, path=path)
self.operator.write_bos_data(self._i_res + len(self))

self.operator.finalize()
Expand Down
Loading