-
Notifications
You must be signed in to change notification settings - Fork 509
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
Statepoint file loading refactor and CAPI function #2886
Conversation
Update: to comply with expected behavior of |
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.
very minor requests!
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.
Thanks for this improvement @pshriwise!
@gridley Can you let us know if you're OK with merging?
Co-authored-by: Paul Romano <[email protected]>
Description
This PR contains a slight refactor of the statepoint loading so it can more cleanly be exposed as part of the CAPI.
It is also a continuation of #2390 in that the scenario where a statepoint is loaded with
n_batches
equal tosettings::n_max_batches
is softened to a warning. This allows previously executed statepoint files can be loaded into an initializedopenmc.lib
instance to recover tally information. An additional check for the current batch vs the max number of batches is added toopenmc_next_batch
to ensure that no particles will be transported in the case that the warning condition is triggered.I think this results in reasonable behavior in the case that a user feeds a statepoint file from a complete OpenMC run back into the
openmc
executable without modification of the batches in the settings file: OpenMC will initialize, load the statepoint file, produce the warning message as part of the statepoint file load, run zero batches, and finalize. Importantly, it will not overwrite the existing statepoint file in this case either. It's somewhat unfortunate that a user will have to wait for problem initialization to get this result, but this was true before these changes as well.We're using this as part of a project with Cardinal to load reaction rate tallies into a separately initialized OpenMC problem to leverage the depletion module for the Bateman eq. solve before sending updated material compositions back into Cardinal.
I went ahead and added a section on simulation restarts as I didn't see any information on it outside of the restart flag passed to the executable.
The restart regression test needed some updating after this to use a fixture that allowed for a check that the correct warning is present.
Checklist
- [ ] I have followed the style guidelines for Python source files (if applicable)addedmodified tests that prove my fix is effective or that my feature works (if applicable)