Skip to content

fix the bug in function differentiate_mats() - #3277

Merged
paulromano merged 3 commits into
openmc-dev:developfrom
cn-skywalker:bug_fix
Jan 28, 2025
Merged

paulromano merged 3 commits into
openmc-dev:developfrom
cn-skywalker:bug_fix

Conversation

@cn-skywalker

Copy link
Copy Markdown
Contributor

Description

I found that differentiate_mats method cannot assign the distributed material properly. When I use the ‘match cell’ method, only one material rather than a list is assigned to the repeating cell. That’s seem to be a bug.
Now it has been fix in this pr.

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)

@paulromano paulromano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@paulromano
paulromano enabled auto-merge (squash) January 28, 2025 05:26
@paulromano
paulromano merged commit d9c8e59 into openmc-dev:develop Jan 28, 2025
Comment thread openmc/model/model.py
if diff_volume_method == 'match cell':
if cell.fill_type == 'distribmat':
for clone_mat in cell.fill:
clone_mat.volume = cell.volume

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Kinda late to the party here, but should the volume assigned to the material be divided by the number of cell instances in this line? Am I missing something?

@pshriwise

Copy link
Copy Markdown
Contributor

Cross-referencing #3132 here as it's related.

@cn-skywalker
cn-skywalker deleted the bug_fix branch January 29, 2025 14:19
ahnaf-tahmid-chowdhury pushed a commit to ahnaf-tahmid-chowdhury/OpenMC that referenced this pull request Feb 6, 2025
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>
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.

3 participants