Skip to content
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

Open
wants to merge 5 commits into
base: devel
Choose a base branch
from

Conversation

loganharbour
Copy link
Member

@loganharbour loganharbour commented Jun 26, 2024

Things still to do

  • Actually verify the test, or setup actual verification?
  • Also add a test with the openmc-only operator?
  • Clean up the python imports in depletion.py
  • Add more comments, maybe a little documentation
  • Setup a proper clean exit of the CardinalOperator that checks to see if MOOSE is also done, otherwise error
  • Clean up the state cleanup before running (hdf5 and tallies)

@loganharbour
Copy link
Member Author

FYI @aprilnovak and @pshriwise; still a mess but it works!

@moosebuild
Copy link
Collaborator

moosebuild commented Jun 26, 2024

Job Documentation on 5e3baba wanted to post the following:

View the site here

This comment will be updated on new commits.

Copy link
Collaborator

@pshriwise pshriwise left a 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.

Comment on lines 25 to 26
super().__init__(*args, **kwargs)

self._control = None
self.cardinal_cmd = None
Copy link
Collaborator

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.

Suggested change
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
Copy link
Collaborator

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?

Suggested change
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}')

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment on lines +213 to +244
if self._control is None:
self.start_cardinal()
Copy link
Collaborator

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:
Copy link
Collaborator

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.

Copy link
Collaborator

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'))
Copy link
Collaborator

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.

Copy link
Collaborator

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.

.gitmodules Outdated Show resolved Hide resolved
@moosebuild
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants