Skip to content

Fix functional weak-form auxiliary field handling - #1663

Open
chvillanuevap wants to merge 5 commits into
developfrom
tupek_flow_hernan
Open

chvillanuevap wants to merge 5 commits into
developfrom
tupek_flow_hernan

Conversation

@chvillanuevap

Copy link
Copy Markdown
Member
  • Refresh auxiliary fields before residual and derivative evaluations.
  • Handle empty coupling parameter packs and use the correct dimension for boundary integrals.

Refresh auxiliary fields before residual and derivative evaluations. Handle empty coupling parameter packs and
    use the correct dimension for boundary objectives.
Comment thread src/smith/physics/functional_weak_form.hpp

@chapman39 chapman39 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lc-hubcast approve

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Three moderate test-coverage requests remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 3 Medium severity · 1 Low severity

Open (4)
What changed in this PR

This pull request improves auxiliary-field refresh behavior, boundary objective integration, and empty coupling-pack handling.

Changes:

  • Adds initialization-state tracking and pre-assembly refresh callbacks.
  • Corrects boundary integration dimensions.
  • Supports empty coupling and parameter packs.
File Summary Review notes
src/​smith/​physics/​state/​state_manager.hpp Adds an initialization-state query. —
src/​smith/​physics/​functional_weak_form.hpp Refreshes auxiliary fields before evaluations. Moderate: add regression coverage for callback refresh behavior. Nit: document the user-visible API change.
src/​smith/​physics/​functional_objective.hpp Corrects boundary integration dimension. Moderate: add a boundary-objective regression test.
src/​smith/​differentiable_numerics/​coupling_params.hpp Handles empty coupling and parameter packs. Moderate: add compile-time coverage for empty-pack combinations.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/smith/differentiable_numerics/coupling_params.hpp
Comment thread src/smith/physics/functional_objective.hpp
Comment thread src/smith/physics/functional_weak_form.hpp
Comment thread src/smith/physics/functional_weak_form.hpp
- Add regression tests for auxiliary-field refresh across residual, Jacobian, JVP, and VJP evaluations.
- Verify residual scaling, frozen-auxiliary finite differences, and derivative consistency.
- Add analytic 2D and 3D boundary-objective integration tests.
- Cover empty coupling and parameter pack combinations with compile-time assertions.
- Simplify empty-pack handling and remove unused StateManager initialization tracking.
- Document callback refresh semantics, quasi-Newton linearization, and the boundary integration dimension convention.

The pre-assembly callback synchronizes externally computed auxiliary fields with the current nonlinear iterate before each evaluation. These fields are held fixed during automatic differentiation, yielding a frozen-auxiliary Jacobian rather than a total derivative through the update.

The targeted FunctionalWeakForm regression passed in a Release build. The corresponding downstream auxiliary-field regression also passed.
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.

3 participants