Skip to content

State-dependent custom operators for block preconditioning - #1649

Open
tlroy wants to merge 22 commits into
developfrom
roy/state-dependent-custom-schur
Open

tlroy wants to merge 22 commits into
developfrom
roy/state-dependent-custom-schur

Conversation

@tlroy

@tlroy tlroy commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Adds state-dependent custom Schur complement approximations for block preconditioners.

Users can provide a custom Schur operator directly, or define one from a weak form whose coefficients depend on the current nonlinear solution. Before each Newton linearization, the preconditioner rebuilds that operator using the latest block state, then uses it for the Schur solve. The PR also adds the weak-form helper API and tests for fixed and state-dependent custom Schur approximations.

@tlroy
tlroy force-pushed the roy/state-dependent-custom-schur branch from fff47df to e911c14 Compare August 19, 2026 19:59

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.

🟡 Changes recommended

A user-facing feature was added but the root release notes file (RELEASE-NOTES.md) was not updated with an “Unreleased” entry.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds support for state-dependent custom block-operator providers (including Schur complement approximations) so block preconditioners can rebuild their internal operators from the current nonlinear iterate before each Newton linearization. This extends the block preconditioner override API beyond fixed operators, wires state refresh into differentiable-numerics Newton solves, and adds weak-form helpers plus tests.

Changes:

  • Introduces StateDependentSolver and state-refresh plumbing for block preconditioners and solver wrappers (SolverWithPreconditioner).
  • Replaces fixed block-operator overrides with provider-based overrides (fixed and state-dependent) and adds factories to build them.
  • Adds weak-form operator builder utilities for fixed/state-dependent overrides and expands tests (including a nonlinear mixed diffusion example).
File summaries
File Description
src/smith/numerics/tests/test_equationsolver.cpp Adds a test ensuring EquationSolver owns/attaches a caller-supplied preconditioner.
src/smith/numerics/tests/test_block_preconditioner_custom_operators.cpp Updates tests to the new provider-override API and adds a state-dependent Schur provider test.
src/smith/numerics/state_dependent_solver.hpp Adds a small interface for solvers that refresh internals from nonlinear state.
src/smith/numerics/solver_with_preconditioner.hpp Makes the wrapper state-refreshable by forwarding updates to owned solver/preconditioner when applicable.
src/smith/numerics/equation_solver.hpp Adds constructor overload for custom owned preconditioners; adds block sub-solver builder helper.
src/smith/numerics/equation_solver.cpp Implements custom-preconditioner construction and factors linear-solver building; adds block sub-solver builder.
src/smith/numerics/CMakeLists.txt Registers the new numerics header.
src/smith/numerics/block_preconditioner.hpp Introduces provider-based override types/factories and updateForState API on block preconditioners.
src/smith/numerics/block_preconditioner.cpp Implements fixed/state-dependent providers and refresh logic; updates Schur custom path to use providers.
src/smith/differentiable_numerics/weak_form_block_operator.hpp Adds helper APIs to assemble weak-form Jacobians for use as block-preconditioner operators.
src/smith/differentiable_numerics/weak_form_block_operator.cpp Implements weak-form operator assembly and state-dependent rebuild logic with DOF elimination support.
src/smith/differentiable_numerics/tests/test_weak_form_block_operator.cpp Adds unit tests for fixed and state-dependent weak-form operator providers.
src/smith/differentiable_numerics/tests/test_state_dependent_preconditioner.cpp Tests Newton-loop state refresh wiring for a state-dependent Schur operator provider.
src/smith/differentiable_numerics/tests/test_porous_heat_sink.cpp Uses weak-form operator override for custom Schur approximation in an existing block solve test.
src/smith/differentiable_numerics/tests/test_nonlinear_mixed_diffusion.cpp Adds an end-to-end nonlinear mixed diffusion test exercising state-dependent custom Schur preconditioning.
src/smith/differentiable_numerics/tests/test_mixed_poisson.cpp Uses weak-form operator override for custom Schur approximation in an existing mixed Poisson test.
src/smith/differentiable_numerics/tests/CMakeLists.txt Registers new differentiable-numerics tests.
src/smith/differentiable_numerics/nonlinear_block_solver.hpp Adds ability to register a state-dependent solver to refresh before Jacobian assembly.
src/smith/differentiable_numerics/nonlinear_block_solver.cpp Calls updateForState before Jacobian assembly; adds builder overload for custom preconditioners.
src/smith/differentiable_numerics/CMakeLists.txt Adds the new weak-form operator source/header to the differentiable-numerics build.
Review details
  • Files reviewed: 20/20 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/smith/numerics/equation_solver.cpp Resolved
@tlroy
tlroy force-pushed the roy/state-dependent-custom-schur branch from 5115f2f to 1ba4206 Compare October 13, 2026 16:11
@tlroy
tlroy requested a review from lihanyu97 October 22, 2026 14:15
Comment thread src/smith/numerics/solver_config.hpp Outdated
Comment on lines 483 to 489

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.

These three options can be packed into a struct with name like BlockPreconditionerOptions, similar to AMGXOptions and AMGFContactOptions above. In this way we don't overflow the LinearSolverOptions container by adding more capabilities.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is done

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.

5 participants