Hypre solver eliminate boundaries (New API) - #3460
Open
bendudson wants to merge 8 commits into
Open
Conversation
This reverts commit 81befc2.
The vector should be assembled once after importing values. Assembling twice with elimBE over-corrects the RHS.
row_indexes is free'd using HypreFree, so should be allocated using HypreMalloc.
The row elimination is now an implementation detail that doesn't require changes to the HypreMatrix and HypreVector interface. The elimination is applied to temporary working vectors when assembling the HypreVector, so the input values are not mutated. New tests check the boundary elimination.
Fixes the integrated Laplace-Hypre3D tests. GPT says: The boundary-elimination logic in [src/sys/hypre_interface.cxx (line 48)](/Users/dudson2/code/BOUT-next/src/sys/hypre_interface.cxx:48) was only removing each boundary variable from one coupled row; in the hypre3d stencil, the same Y-boundary value can appear in multiple nearby rows, especially in the SOL case. I changed BoundaryElimination to collect all representable row couplings for each boundary equation, store them with per-boundary offsets, and apply them during matrix reduction, RHS reduction, and matvec reconstruction. The interface metadata was updated in [include/bout/hypre_interface.hxx (line 103)](/Users/dudson2/code/BOUT-next/include/bout/hypre_interface.hxx:103), and I added multi-coupling unit coverage in [tests/unit/include/bout/test_hypre_interface.cxx (line 618)](/Users/dudson2/code/BOUT-next/tests/unit/include/bout/test_hypre_interface.cxx:618).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #3439, using a new API that doesn't require sharing boundary information between matrices, rhs and solution vectors. Avoids hidden mutations that could be hard to reason about.
Includes additional tests and some changes to the boundary row elimination code.
Written almost entirely by Codex/gpt-5.4 with review and iterations.