Add reactivity control to coupled transport-depletion analyses #2693
Add reactivity control to coupled transport-depletion analyses #2693church89 wants to merge 86 commits intoopenmc-dev:developfrom
Conversation
update pr with latest commits from development branch
Update with latest develop before open pr
drewejohnson
left a comment
There was a problem hiding this comment.
@church89 thank you for this lengthy and useful PR! I think this is going to unlock a lot of doors for people and provide a lot of value. I haven't done a full review but I wanted to get some of my larger thoughts out first, make sure we understand the vision and goal, and then refine my review as we go.
Some simple things
- Please re-evaluate the docstrings you've added to align with the
numpydocspec Otherwise our built documentation isn't going to process this properly - Please run a python formatter like
blackto make sure your code adheres to pep8 formatting style like the dev guide requests - Please consolidate property setters / getters / validators. I think it's going to be easier for us in the long run to maintain / add validators if we do validation on things like
self.tolif all validation is done in property setters
Maybe a larger lift: I think the high-level class and method name, using batch wise, might not communicate what we want to communicate. My rationale is I believe this engages after a full transport simulation, while openmc uses the "batch" terminology to mean generations of particles in a given transport simulation - docs
so users who already are configuring an openmc run to have so many inactive / active generations per batch may expect this search to be performed more often than it is actually performed.
But, based on your PR message
It effectively runs an iterative search_for_keff sub-step algorithm to maintain keff equal to 1 (or some other user defined targets) as a function of some user defined model parameter to update, before calculating the BOS from the transport run
and my non-exhaustive review, I could be wrong. If we are making changes to the model during batches of active generations, then this name makes sense. But if we are not, I would encourage us to consider new names.
I hope to have time in the next week or so for a more detailed review, but I wanted to get something out the door to let you know I've seen this, I believe it's valuable, and I have some (hopefully) low-hanging requests
| res_test = openmc.deplete.Results(path_test) | ||
| res_ref = openmc.deplete.Results(path_reference) | ||
|
|
||
| # Use high tolerance here |
There was a problem hiding this comment.
Oof a 2% relative tolerance is high. But we've got a stochastic code, and probably wanting to get the simulation to converge reasonably quickly.
I'd like to see a tighter tolerance but I understand that might not be tenable.
Co-authored-by: Andrew Johnson <drewejohnson@users.noreply.github.com>
|
Hi @drewejohnson, thanks for starting this review. I've begun to address your comments/suggestions. I can see how |
|
Thanks @paulromano for getting back to this PR. Looks reasonable to me to separate the |
…penmc-dev-develop
Batchwise pr keff search update
|
@paulromano this PR has finally been refactored and simplified a lot based on the awesome #3569 and earlier discussions. Haven't fully tested it yet but you can go through it when you have some time and tell me what you think! |
paulromano
left a comment
There was a problem hiding this comment.
Thanks for the updates on this PR @church89! Regarding the name of this feature, I think it would be more explicit to have:
Integrator.add_keff_searchKeffSearchControl
Also, since KeffSearchControl doesn't appear to be something users would instantiate directly, I think it should be an internal class (_KeffSearchControl) that is really an implementation detail (which gives us the freedom to change it later on if we want).
There are a few items that need to be addressed below:
| Updated atom density vector synchronized across all ranks | ||
| """ | ||
| for rank in range(comm.size): | ||
| number_i = comm.bcast(self.operator.number, root=rank) |
There was a problem hiding this comment.
If the density change is being made through openmc.lib, wouldn't this end up resetting the densities to what they were before since operator.number doesn't get updated?
openmc/deplete/reactivity_control.py
Outdated
| if root < self.kwargs['x_min']: | ||
| warn( | ||
| f"keff search result ({root:.6f}) is below the lower bracket bound " | ||
| f"({self.kwargs['x_min']:.6f}). Clamping to bracket lower bound.", | ||
| UserWarning | ||
| ) | ||
|
|
||
| elif root > self.kwargs['x_max']: | ||
| warn( | ||
| f"keff search result ({root:.6f}) is above the upper bracket bound " | ||
| f"({self.kwargs['x_max']:.6f}). Clamping to bracket upper bound.", | ||
| UserWarning | ||
| ) |
There was a problem hiding this comment.
It says it's being clamped but I don't actually see any clamping below?
|
Hi @paulromano thanks for the comments. I've addressed now all of them and as suggested I've renamed the class to |
Description
This pr adds the capability to perform batch-wise reactivity control during a coupled transport-depletion analysis.
It effectively runs an iterative
search_for_keffsub-step algorithm to maintain keff equal to 1 (or some other user defined targets) as a function of some user defined model parameter to update, before calculating the BOS from the transport run and proceed with the depletion step.The model variable to parametrize during the sub-step can be of geometrical (e.g. control rod position) or material (e.g. refuel) nature, acting on a
openmc.Cellandopenmc.Material, respectively.A batch-wise scheme can be added to an
integratorinstance and a coupled transport-depletion simulation can be run like this:where
cellis anopenmc.Cellconveniently defined that can be translated along thez-axisduring the run.Checklist