Add cell_wise MGXS generation method#3987
Open
jon-proximafusion wants to merge 1 commit into
Open
Conversation
1f966fd to
8698b76
Compare
Add method="cell_wise" to Model.convert_to_multigroup: like material_wise, but gives each cell its own multigroup cross sections. The material in every material-filled cell is cloned (each clone gets a unique id), then the standard per-material generation runs, so per material becomes per cell. This captures the intra-material spatial-spectrum variation that material_wise averages away when one material spans a strong gradient. The implementation reuses the material_wise path entirely; the only new code is the per-cell cloning step in convert_to_multigroup plus the dispatch entry. Adds unit tests (CSG and DAGMC: two cells sharing a material get distinct macroscopics) and a user guide entry in the MGXS methods table. Builds on the name+id library keying from openmc-dev#3984 (now in develop). Co-authored-by: jon-proxima <jon@proximafusion.com>
8698b76 to
3681d7c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a
cell_wiseMGXS generation methodLike
material_wise, but gives each cell its own multigroup cross sections, so itcaptures the intra-material spatial variation that
material_wiseaverages away(for example a steel material reused in several cells).
Implementation
Full reuse of the
material_wisepath. Before generation, the material in everymaterial-filled cell is cloned (each clone gets a unique id via
Material.clone()). The standard per-material generation then produces and assignsone cross section set per cell. The only new code is the per-cell cloning step in
convert_to_multigroupplus the dispatch entry (about 20 lines).material_wisebehavior is unchanged.
Works for both CSG and DAGMC.
convert_to_multigroupalready synchronizes DAGMCcells before generation, so the per-cell clones become standard DAGMC per-cell
material overrides with no special handling.
Contents
openmc/model/model.py: the per-cell cloning step and dispatch entry.tests/unit_tests/test_model.py: CSG unit test (two cells sharing a material getdistinct macroscopics).
tests/unit_tests/dagmc/test_convert_to_multigroup.py: DAGMC unit test (a modelwith two fuel volumes sharing one material yields three distinct per-cell
macroscopics).
docs/source/usersguide/random_ray.rst: addscell_wiseto the methodlist and to the "Comparison of Automatic MGXS Generation Methods" table.
Verification
section sets, while
material_wiseon the same model produces one (regressionintact).
dagmc.h5mmodel (two fuel volumes sharing one material,plus water) yields three distinct per-cell macroscopics; void volumes are
skipped.
Status
develop(the name+id library keying from Preserve user material names in convert_to_multigroup and avoid overwriting material with same name bug fix #3984 is merged).distribcell(per-instance) granularity. This PR doesper-cell-definition (one cross section set per cell, shared across lattice
instances).