Skip to content

Conversation

yrrepy
Copy link
Contributor

@yrrepy yrrepy commented Oct 1, 2025

Description

Currently, OpenMC cannot use the mesh that is on the weight windows HDF5 file.

This creates all number of frustrations. The handling of the weight window mesh in general is super awkward.
OpenMC tries to find any mesh matching the ww.h5 mesh ID already existing in the problem, but some methods strip out tallies (deplete.get_microxs_and_flux) and suddenly the mesh filter that might be useful is gone.
One way that worked for me was bootstrapping in an entropy mesh.

settings.weight_windows.mesh doesn't seem to work with ww.h5s

This change enables OpenMC to get the mesh from the ww.h5 directly during execution and use it for the weight window.
To me, this also just feels cleaner, less error prone and more straightforward.

This is vibe coded with Claude. I have shepherded it and verified that it works.
Right now only compatible with rectilinear mesh (verified) and ostensibly with a regular mesh (not verified).

Fixes (in a way) #3549

An Alternative:
Have the Python API get the mesh from the ww.h5 and export that as a mesh to settings.

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)

yrrepy added 2 commits October 1, 2025 12:51
Works with Regular Mesh and Rectilinear Mesh.

Only tested on a Rectilinear Mesh (which was actually a Regular Mesh created from an Advantg wwinp)
@pshriwise
Copy link
Contributor

I like the premise here, @yrrepy! It would indeed be nice to be able to load meshes from HDF5 files in some cases. Thanks for the contribution.

I'll think this one over a bit, but one suggestion to consider for now: I think the code that creates new meshes would be more impactful in methods like RegularMesh::from_hdf5 and RectilinearMesh::from_hdf5. Your thoughts?

@yrrepy
Copy link
Contributor Author

yrrepy commented Oct 2, 2025

Don't really know those blocks.

But I guess your idea is it could be created in more of a general way (the mesh retrieval from hdf5), and then that can be called in the WeightWindows::from_hdf5?

I suppose a general implementation usable by other HDF5 interacting code could be useful, for situations where you have some other form of h5 file with a mesh on it. Can't think of another one off the top of my head, but I'm sure theres likely some application there.

But yeah sounds like a cleaner, more general way.

@yrrepy
Copy link
Contributor Author

yrrepy commented Oct 7, 2025

Looks like I've been sniped.
#3598

But we're getting the functionality in and surely a better implementation.

@yrrepy yrrepy closed this Oct 7, 2025
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.

2 participants