Skip to content

Fix bug in fields::_require_component when allocating new fields#3188

Open
oskooi wants to merge 5 commits intoNanoComp:masterfrom
oskooi:require_component_bugfix
Open

Fix bug in fields::_require_component when allocating new fields#3188
oskooi wants to merge 5 commits intoNanoComp:masterfrom
oskooi:require_component_bugfix

Conversation

@oskooi
Copy link
Copy Markdown
Collaborator

@oskooi oskooi commented Apr 2, 2026

Bug: fields::_require_component() in src/fields.cpp:553 allocates new field arrays when a source is added (via alloc_f), and sets chunk_connections_valid = false, but does not set changed_materials = true. On the next step() call, step_db() lazily allocates PML auxiliary arrays (f_u) for the newly-created field components, which requires changed_materials to be true per the assertion.

Fix: (src/fields.cpp:568-573): Set changed_materials = true when _require_component allocates new fields.

@oskooi oskooi added the bug label Apr 2, 2026
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.87%. Comparing base (f29a8c7) to head (73cc10a).
⚠️ Report is 120 commits behind head on master.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3188      +/-   ##
==========================================
+ Coverage   73.81%   73.87%   +0.05%     
==========================================
  Files          18       18              
  Lines        5423     5458      +35     
==========================================
+ Hits         4003     4032      +29     
- Misses       1420     1426       +6     

see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@stevengj
Copy link
Copy Markdown
Collaborator

stevengj commented Apr 3, 2026

This could be triggered if you do some timestepping, and then add a source (triggering field allocation). I think we don't see this bug currently because we virtually always create fields at the beginning and then timestep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants