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

Differentiate materials in DAGMC universes #3056

Merged
merged 128 commits into from
Jan 7, 2025

Conversation

bam241
Copy link
Contributor

@bam241 bam241 commented Jun 22, 2024

Description

This allows to differentiate materials in DAGMC universe when using the same DAGMC geometry to fill different CG cells

This provides a mechanism to overload material assignment embedded in the DAGMC geometry by providing a dict {ref_mat_name:[mat_instances]}
This allows enrich the Model.differentiate_depletable_material() method from the Python API, to allows automatic differentiation of the depletable materials of a DAGMC geometry inserted multiple times.

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)

this should address #2923

This work has been sponsored by NAAREA.

Sorry, something went wrong.

@bam241 bam241 force-pushed the dagmc_decoupling branch from b30d703 to 5ec8978 Compare July 24, 2024 04:38
@bam241 bam241 force-pushed the dagmc_decoupling branch from 5ec8978 to 394d585 Compare July 31, 2024 16:38
Baptiste Mouginot and others added 10 commits August 2, 2024 11:01
up
@bam241 bam241 marked this pull request as ready for review August 12, 2024 15:30
Copy link
Contributor

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

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

Not an easy task @bam241 and I think I see where you're going with it. My main concern with the current implementation is the amount of DAGMC-specific code in higher-level sections of the Python API. I think there's some refactoring we can do to avoid special logic in the Model and (maybe) Geometry classes.

I'd say this is optional for this PR, but now that we have additional DAGMC* classes appearing I wonder if it would be best to move them all into a dagmc.py file in the Python API. I thought doing this in the C++ code was nice as DAGMC constructs have their own special logic to some degree. It would reduce the size of our cell.py and universe.py files as well. I can tackle that afte we finish this PR though. Making an issue to track...

openmc/lib/dagmc.py Show resolved Hide resolved
openmc/lib/dagmc.py Outdated Show resolved Hide resolved
openmc/model/model.py Outdated Show resolved Hide resolved
openmc/model/model.py Outdated Show resolved Hide resolved
openmc/model/model.py Outdated Show resolved Hide resolved
openmc/universe.py Outdated Show resolved Hide resolved
openmc/universe.py Outdated Show resolved Hide resolved
openmc/universe.py Outdated Show resolved Hide resolved
include/openmc/cell.h Show resolved Hide resolved
openmc/geometry.py Outdated Show resolved Hide resolved
openmc/dagmc.py Outdated
"""
for cell in self.cells.values():
if isinstance(cell.fill, Iterable):
self.add_material_override(cell, [mat for mat in cell.fill if mat])
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this alter the intended cell fills if some of the entries in the cell.fill are skipped?

openmc/dagmc.py Outdated Show resolved Hide resolved
bam241 and others added 12 commits December 22, 2024 11:41
Co-authored-by: Baptiste Mouginot <15145274+bam241@users.noreply.github.com>
…e a new method for material replacement.

Other changes:

  * remove unused DAGMCUniverse.dagmc_cells attribute
  * update documentation on material_overrides attribute
  * alter XML layout so potentially long strings of material IDs are text of an element rather than attributes
  * update XML documentation to reflect structure changes
… with cell, override with cell ID, and replacement with mat name
…essaging corresponding to material overrides
Copy link
Contributor

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

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

I think this is in a good place @bam241! Thank you for all your effort on this!

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.

Just finished making some updates throughout. Thanks for your work on this @bam241!

@paulromano paulromano enabled auto-merge (squash) January 7, 2025 19:50
@paulromano paulromano merged commit 5ad1a4a into openmc-dev:develop Jan 7, 2025
15 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.

None yet

4 participants