Add cell_wise MGXS generation method#3987
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
jtramm
left a comment
There was a problem hiding this comment.
This looks great @jon-proximafusion -- thanks so much for adding it in! I think it should be a cheap way of improving fidelity vs. the current material-wise method.
Just one small comment below on adding some extra clarifying discussions to the docs.
Additionally - we currently have end-to-end testing for all the MGXS generation techniques in tests/regression_tests/random_ray_auto_convert/test.py, so you could add the new method to the @parametrize list there to test it as well.
| * Like ``material_wise``, but clones the material in each cell so every | ||
| cell gets its own cross sections (each material-filled cell is assigned a | ||
| distinct macroscopic). | ||
| - * Resolves intra-material spatial variation that ``material_wise`` averages | ||
| away, e.g. a thick shield or a steep flux gradient within a single material | ||
| * Captures spatial self shielding between cells filled with the same material | ||
| - * Most expensive (one cross section set per cell) and a larger library | ||
| * Same far-from-source limitation as ``material_wise``: a cell that is not | ||
| tallied to yields zero cross sections for that cell |
There was a problem hiding this comment.
We might want to add a note clarifying that it is generating unique MGXS data for each cell and not for each cell instance. Basically, it would be nice to alert the user that a cell that shows up in multiple locations of a lattice would have the same MGXS data set for all locations. If this type of discussion ends up being too wordy for the table formatting, perhaps it can be included as regular text elsewhere in the section.
- Resolves intra-material spatial variation that
material_wiseaverages
away, e.g. a thick shield or a steep flux gradient within a single material- Captures spatial self shielding between cells filled with the same material
I don't completely agree with, as a cell may still be very large and have a steep gradient within it. A full shield wall may easily just be defined with one cell, in which case, you still are sharing the same MGXS throughout the full wall (even if you had applied a cell-under-voxel overlay to make smaller source regions). You only get an improvement if you had manually broken the shield wall down in your geometry definition into multiple cells that cover different depths of the wall. Basically, we don't want to oversell this method in terms of fidelity.
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).