Skip to content

Hypre solver eliminate boundaries (New API) - #3460

Open
bendudson wants to merge 8 commits into
nextfrom
next-elimBE-new-api
Open

Hypre solver eliminate boundaries (New API)#3460
bendudson wants to merge 8 commits into
nextfrom
next-elimBE-new-api

Conversation

@bendudson

Copy link
Copy Markdown
Contributor

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.

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).
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.

1 participant