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

Support track file writing for particle restart runs. #2957

Merged
merged 3 commits into from Apr 24, 2024

Conversation

pshriwise
Copy link
Contributor

Description

This PR should help streamline lost particle debugging by enabling a track file write with the following workflow:

# run produces lost particle files
openmc
# restart with a particle file and produce a `tracks.h5` file with the resulting track for debugging
openmc -r <particle_file> -t

or in Python

# produces a `RuntimeError`
model.run()
# apply a particle file and produce the track
model.run(restart_file=particle_filepath, tracks=True)

This just involved opening and closing a track file for the run_particle_restart function. Those calls are typically made in openmc_simulation_init but that function isn't called for a particle restart run. I've added a test to ensure the above workflow is possible going forward.

Fixes #2956

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 15) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

Copy link
Contributor

@gridley gridley left a comment

Choose a reason for hiding this comment

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

Nice simple fix and test! This is pretty essential functionality, so I'm happy it's fixed now.

Copy link
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

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

LGTM

@paulromano paulromano enabled auto-merge (squash) April 24, 2024 18:59
@paulromano paulromano merged commit 7936b8a into openmc-dev:develop Apr 24, 2024
17 checks passed
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.

Track file not generated on particle restart run
3 participants