Skip to content

Fix get_flux_index and get_gradient_index for multi-flux materials - #19

Open
theronguo wants to merge 1 commit into
bleyerj:mainfrom
theronguo:fix-flux-gradient-index
Open

Fix get_flux_index and get_gradient_index for multi-flux materials#19
theronguo wants to merge 1 commit into
bleyerj:mainfrom
theronguo:fix-flux-gradient-index

Conversation

@theronguo

Copy link
Copy Markdown

MaterialStateManager.get_flux_index and get_gradient_index were using the list position of the name as the start offset into the flat DOF array, rather than the cumulative sum of preceding entry sizes. For single-flux materials this worked by accident (list index 0 = offset 0), but for any material with multiple flux or gradient entries of size > 1 the returned indices were wrong, causing incorrect reads/writes in advance() and set_item().

MaterialStateManager.get_flux_index and get_gradient_index were using
the list position of the name as the start offset into the flat DOF
array, rather than the cumulative sum of preceding entry sizes. For
single-flux materials this worked by accident (list index 0 = offset 0),
but for any material with multiple flux or gradient entries of size > 1
the returned indices were wrong, causing incorrect reads/writes in
advance() and set_item().
@bleyerj

bleyerj commented May 21, 2026

Copy link
Copy Markdown
Owner

Hi @theronguo thanks for spotting this.
Do you happen to have a minimal test case which failed previously to add to the test suite ?

@theronguo

Copy link
Copy Markdown
Author

Hi @bleyerj,
Please find here a minimal test case that failed before:
test_multi_flux_index.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.

2 participants