-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenMC depletion coupling #921
base: devel
Are you sure you want to change the base?
Conversation
FYI @aprilnovak and @pshriwise; still a mess but it works! |
Job Documentation on 5e3baba wanted to post the following: View the site here This comment will be updated on new commits. |
95b5008
to
5e3baba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good!! Thank you for creating this @loganharbour. Mostly line changes here and a couple questions about integrating it into a Cardinal install.
python/cardinal_operator.py
Outdated
super().__init__(*args, **kwargs) | ||
|
||
self._control = None | ||
self.cardinal_cmd = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move these attribute initializations before the super().__init__
call so we don't get an AttributeError
from CardinalOperator.__del__
if the parent constructor fails.
super().__init__(*args, **kwargs) | |
self._control = None | |
self.cardinal_cmd = None | |
self._control = None | |
self.cardinal_cmd = None | |
super().__init__(*args, **kwargs) |
nuclides = [n for n in t.nuclides] | ||
names_path = f'{uo_path}/names' | ||
self._control.setControllableVectorString(names_path, nuclides) | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this now, right?
break |
for t in openmc.lib.tally.tallies.values(): | ||
uo_path = f'UserObjects/openmc_tally{t.id}' | ||
logger.info(f'Updating tally {t.id} via {uo_path}') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if self._control is None: | ||
self.start_cardinal() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggesting the tiniest of refactors: This pattern appears often. Do we want to put it into a method like ensure_cardinal
?
|
||
# All of these imports are awful and we'll figure | ||
# out a better way to do it before merging | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems fair to me to expect users to have installed the OpenMC Python package used with Cardinal, but it doesn't look like your typical installation as that's going to occur from the submodule. Offhand thoughts:
- (optionally) Install the OpenMC Python API as part of the Cardinal build
- Include setting of
PYTHONPATH
to the OpenMC submodule in Cardinal's installation docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be awesome if we automatically installed the Python API when installing Cardinal -- it's listed in this issue: #592
try: | ||
from cardinal_operator import CardinalOperator | ||
except: | ||
cardinal_contrib = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'python')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above, this could also be solved by requiring the PYTHONPATH
to be set to CARDINAL_HOME/python
in the installation notes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A warning similar to the one about NEKRS_HOME
could be provided perhaps.
08524b4
to
470411b
Compare
Job Documentation, step Sync to remote on 470411b wanted to post the following: View the site here This comment will be updated on new commits. |
Things still to do
depletion.py
CardinalOperator
that checks to see if MOOSE is also done, otherwise error