Skip to content

Feature/isomeric gendf#26

Open
yrrepy wants to merge 11 commits intoisomeric-gendf_Sync1from
feature/isomeric-gendf
Open

Feature/isomeric gendf#26
yrrepy wants to merge 11 commits intoisomeric-gendf_Sync1from
feature/isomeric-gendf

Conversation

@yrrepy
Copy link
Owner

@yrrepy yrrepy commented Feb 9, 2026

Update sync with latest development commits

yrrepy and others added 11 commits January 17, 2026 23:08
Make it consistent with get_microxs_and_flux
Remove energy_structure and backend params from GENDFLibrary.
As elsewhere, energy is now auto-detected from the GENDF files.
GENDF backend selection is automated.

 Changes to be committed:
	modified:   openmc/deplete/coupled_operator.py
	modified:   openmc/deplete/gendf.py
	modified:   openmc/deplete/helpers.py
	modified:   openmc/deplete/independent_operator.py
	modified:   openmc/deplete/microxs.py
	modified:   openmc/lib/gendf.py
	modified:   tests/unit_tests/test_gendf_elis_mapping.py
	modified:   tests/unit_tests/test_isomeric_branching_weighting.py
	modified:   tools/add_gendf_isomeric_branching_to_chain.py
  In __init__, filter fluxes, cross_sections, and _flux_with_energy to
  local materials only and remap _mat_index_map to local sequential
  indices. This reduces per-rank memory from O(all_materials) to
  O(local_materials).

  In _update_materials, replace the broadcast loop with local-only
  negative-density zeroing. Unlike CoupledOperator, IndependentOperator
  has no C library to synchronize material compositions with — the
  only required action is zeroing negative densities produced by CRAM.

 Works in and around the isomeric branching implementation.
the library's own energy structure (matching C++ backend API). Add
_energy_validated flag to skip redundant np.allclose() on 1103-element
arrays after the first successful validation.
The current per-reaction get_xs() loop generates ~35,000 KeyError
exceptions per depletion step (most nuclides lack most reactions) and
re-loads the GENDF material on each call. get_all_xs() loads the
material once and returns only the reactions that exist, eliminating
the exception overhead.

_SparseXSTable stores only the non-zero (nuclide, reaction) XS as a
contiguous (nnz, n_groups) matrix. This enables collapsing all XS in
a single BLAS dgemv call instead of N_nuc × N_rxn individual dot
products, and reduces memory from ~370 MB dense to ~44 MB sparse.

Extract threshold alignment logic into _extract_xs() shared by
get_xs() and get_all_xs(). C++ backend wrapper loops get_xs() per MT
from a caller-provided list. _build_sparse_xs_table() builder
assembles the table from get_all_xs() calls. Not yet wired into the
depletion workflow.
Changes to be committed:
	modified:   openmc/deplete/gendf.py
	modified:   openmc/deplete/microxs.py
	modified:   openmc/lib/gendf.py
Replace the per-domain, per-nuclide, per-reaction get_xs() loop with a
single _SparseXSTable build followed by vectorized matrix-vector collapse.

Exploit domain-independence of GENDF cross-sections: extract XS once,
collapse per domain via single BLAS dgemv instead of per-nuclide Python
dot products. Eliminates D× redundant XS extraction. Reduces peak memory.

In get_gendfxs_and_flux(), the previous code called
from_multigroup_flux_with_gendf() D times (once per domain), each
performing N_nuc × N_rxn individual get_xs() calls with try/except.
GENDF cross-sections are domain-independent, so all D calls extracted
identical data. The sparse table is now built once and reused for all
domains, reducing D × N_nuc × N_rxn get_xs() calls to N_nuc get_all_xs()
calls plus D BLAS dgemv collapses.

In from_multigroup_flux_with_gendf(), the nested for-nuc/for-mt/try-except
loop is replaced with _build_sparse_xs_table() + table.collapse(), giving
single-domain callers the same vectorized path.

This new workflow

Update MockGENDFLibrary in test_gendf_nuclide_filtering.py to implement
n_groups and get_all_xs() required by _build_sparse_xs_table().
Changes to be committed:
	modified:   openmc/deplete/microxs.py
	modified:   tests/unit_tests/test_gendf_nuclide_filtering.py
 Untracked files:
	tests/unit_tests/test_sparse_xs_table_validation.py
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.

1 participant