Skip to content

Conversation

@GuySten
Copy link
Contributor

@GuySten GuySten commented Jan 22, 2026

Description

openmc crash when trying to plot a model with multigroup cross sections.
This PR fix that.

Fixes #3747

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)

@GuySten GuySten requested review from paulromano and pshriwise and removed request for paulromano January 22, 2026 15:42
@GuySten GuySten added the Bugs label Jan 22, 2026
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.

Thanks @GuySten. I ended up removing all the extra code related to cross_sections. The recommended way to handle the data is to set openmc.config['mg_cross_sections'] before calling the plot() method. I'll comment on the original issue too.

@GuySten
Copy link
Contributor Author

GuySten commented Jan 30, 2026

There were a few problems:

  1. You plotted a surface so the material lookup did not happen.
  2. When the mg_cross_sections are used as a relative path they do not work because when plotting we switch to a temporary directory.
  3. I also added an informative error to the users to set mg cross sections path before plotting.

@GuySten GuySten requested a review from paulromano January 30, 2026 00:06
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.

Sorry about the mishaps in my updates. I did make another change to simplify the additions to Model.plot. The reason that the relative path didn't work in the test is because for testing we set openmc.config['resolve_paths'] = False, so the relative path is kept. However, the default configuration for users is openmc.config['resolve_paths'] = True which means that it should work out of the box for users. Instead of introducing config.patch in Model.plot, I changed it so that we set the absolute path in the test. Let me know if you're OK with this now and if so, we're good to merge.

@GuySten
Copy link
Contributor Author

GuySten commented Jan 30, 2026

Now we are good to merge.

@GuySten GuySten enabled auto-merge (squash) January 30, 2026 00:25
@GuySten GuySten merged commit 7b4617a into openmc-dev:develop Jan 30, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kernel crashes when plotting universes with multigroup materials

2 participants