Skip to content

Implement a new MeshMaterialFilter #3406

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

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

paulromano
Copy link
Contributor

Description

This PR implements a new MeshMaterialFilter that allows tallying specific combinations of mesh elements and materials. In principle, one can already do this by combining a MeshFilter and a MaterialFilter. However, in many cases a single mesh element only contains a few materials, which means tallying every single material for each mesh element would be very wasteful. This new filter works in conjunction with the Mesh.material_volumes() method, which returns a MeshMaterialVolumes object. This filter has a from_volumes() classmethod that will create a filter with bins for all mesh element-material combinations that were found from the call to material_volumes(). So, the workflow is basically:

# Build your model
model = openmc.Model()
...

# Set up a mesh
mesh = openmc.RegularMesh()
...


# Determine materials present in each mesh element
mat_vols = mesh.material_volumes(model, ...)

# Create corresponding filter
mm_filter = openmc.MeshMaterialFilter.from_volumes(mat_vols)

This new filter is one of the last infrastructural pieces needed to carry out mesh-based subvoxel R2S calculations.

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)

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.

1 participant