Skip to content

[LinearSolvers] Potential bug from AI-agent audit: setBCoeffs(Vector) overwrites all components #4961

@hanfluid

Description

@hanfluid

Baseline checked on 2026-02-22:

  • development: 98bce0678fe1129b3df19e558c0fb21350e5f0b0 (2026-02-21)
  • release 26.02: 33007cb7d8798b53082323275ae70ead3e1e9ffa (2026-02-02)

In two Vector-overload setters, each loop iteration calls setVal(value) without component arguments:

  • Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H:389-395
  • Src/LinearSolvers/MLMG/AMReX_MLEBABecLap.cpp:178-184

Code pattern:

for (int icomp = 0; icomp < ncomp; ++icomp) {
    m_b_coeffs[amrlev][0][idim].setVal(beta[icomp]);
}

setVal(val) sets all components, so for ncomp > 1 every component is repeatedly overwritten and ends up equal to beta[ncomp-1].

Trigger

  • multi-component solve (ncomp > 1)
  • call setBCoeffs(amrlev, Vector<...> const& beta)

Expected

Set component icomp only, e.g.

setVal(beta[icomp], icomp, 1, 0)

Impact

Incorrect per-component b coefficients and therefore wrong operator coefficients/solutions for multi-component usage.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions