Repository navigation
Statepoint file loading refactor and CAPI function - #2886
Merged
Merged
Conversation
Contributor
Author
|
Update: to comply with expected behavior of |
gridley
suggested changes
Mar 13, 2024
paulromano
approved these changes
Apr 24, 2024
paulromano
left a comment
Contributor
There was a problem hiding this comment.
Thanks for this improvement @pshriwise!
@gridley Can you let us know if you're OK with merging?
gridley
approved these changes
Apr 24, 2024
church89
pushed a commit
to openmsr/openmc
that referenced
this pull request
Jul 18, 2024
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
apingegno
pushed a commit
to apingegno/openmc
that referenced
this pull request
May 7, 2026
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_batchesequal tosettings::n_max_batchesis softened to a warning. This allows previously executed statepoint files can be loaded into an initializedopenmc.libinstance to recover tally information. An additional check for the current batch vs the max number of batches is added toopenmc_next_batchto 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
openmcexecutable 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)