Skip to content

Add function to remove boundary contributions#495

Merged
greole merged 6 commits into
developfrom
fix/failingDiagTest
May 13, 2026
Merged

Add function to remove boundary contributions#495
greole merged 6 commits into
developfrom
fix/failingDiagTest

Conversation

@greole
Copy link
Copy Markdown
Contributor

@greole greole commented Apr 27, 2026

This PR adds a function to remove boundary contributions from the matrix diagonal. The reasoning is that other CFD frameworks might or might not add boundary contributions to the diagonal matrix. Currently, NeoN directly adds the boundary contributions to the diagonal matrix and stores them in the boundMatrix. To simplify testing a function is added to remove these contributions.

Additionally:

  • This PR fixes the inconsistent handling of the boundary RHS vector where the values are overwritten instead of added by the operator.
  • Not installing all required fmt targets
  • add .bck and .claude to gitignore. This also prevents reuse from complaining

@github-actions
Copy link
Copy Markdown

Thank you for your PR, here are some useful tips:

Comment thread src/linearAlgebra/matrix.cpp Outdated
@greole greole added the ready-for-review Set this label to indicate that the PR is ready for review label Apr 28, 2026
@greole greole force-pushed the fix/failingDiagTest branch from f34669a to 3eacc3e Compare April 28, 2026 07:45
@greole greole marked this pull request as ready for review April 28, 2026 07:46
@greole greole requested a review from Copilot April 28, 2026 09:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to adjust how boundary contributions are tracked/applied in finite-volume operator assembly (and adds a helper to remove those contributions for testing), alongside a new lower() matrix utility declaration.

Changes:

  • Update boundary-face accumulation behavior in Gauss-Green Laplacian/Div implicit assembly (boundary matrix/RHS tracking and diagonal updates).
  • Add removeBoundaryContributions(...) helper on LinearSystem for test workflows.
  • Declare a new lower(...) triangular extraction function in the linear algebra API.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/linearAlgebra/matrix.cpp Minor formatting-only change (extra blank line).
src/finiteVolume/cellCentred/operators/gaussGreenLaplacian.cpp Changes boundary-face diagonal/RHS updates and boundary tracking.
src/finiteVolume/cellCentred/operators/gaussGreenDiv.cpp Changes boundary-face diagonal/RHS updates and boundary tracking (implicit path).
include/NeoN/linearAlgebra/matrix.hpp Declares lower(...) and adds Doxygen comments.
include/NeoN/linearAlgebra/linearSystem.hpp Adds removeBoundaryContributions(...) testing helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/finiteVolume/cellCentred/operators/gaussGreenDiv.cpp Outdated
return upper;
}


Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

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

This diff introduces an extra blank line between functions. If the project is keeping spacing tight in this file, consider removing it to avoid noisy diffs.

Copilot uses AI. Check for mistakes.
Comment thread src/finiteVolume/cellCentred/operators/gaussGreenLaplacian.cpp Outdated
Comment thread include/NeoN/linearAlgebra/matrix.hpp Outdated
Comment thread include/NeoN/linearAlgebra/matrix.hpp Outdated
Comment thread include/NeoN/linearAlgebra/linearSystem.hpp
Comment thread include/NeoN/linearAlgebra/linearSystem.hpp Outdated
Comment thread include/NeoN/linearAlgebra/linearSystem.hpp Outdated
@greole greole force-pushed the fix/failingDiagTest branch from 3eacc3e to 7464dfe Compare April 29, 2026 16:01
@greole greole changed the title add function to remove boundaryContribbutions, fix boundaryValue add Add function to remove boundary contributions Apr 29, 2026
@greole greole force-pushed the fix/failingDiagTest branch from eb9dd62 to 0036ab7 Compare April 29, 2026 16:17
@chihtaw
Copy link
Copy Markdown
Collaborator

chihtaw commented May 4, 2026

Is the function for removing boundary contributions solely for the purpose of testing in distributed settings?

@greole
Copy link
Copy Markdown
Contributor Author

greole commented May 4, 2026

As of now, solely for testing purposes.

@greole greole added skip-build Skip all the build-and-test jobs in CI and removed skip-build Skip all the build-and-test jobs in CI labels May 5, 2026
@greole greole force-pushed the fix/failingDiagTest branch from 0036ab7 to 8d0c64b Compare May 6, 2026 12:53
Copy link
Copy Markdown
Collaborator

@chihtaw chihtaw left a comment

Choose a reason for hiding this comment

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

We need proper unit tests to validate the boundary matrix and boundary RHS in operator evaluations so that bugs won't easily sneak into the operator evaluations next time.

Comment thread include/NeoN/linearAlgebra/matrix.hpp Outdated
Comment thread src/finiteVolume/cellCentred/operators/gaussGreenDiv.cpp
Comment thread src/finiteVolume/cellCentred/operators/gaussGreenDiv.cpp
Comment thread src/finiteVolume/cellCentred/operators/gaussGreenLaplacian.cpp
Comment thread src/finiteVolume/cellCentred/operators/gaussGreenLaplacian.cpp
Comment thread CMakeLists.txt Outdated
Comment thread .gitignore Outdated
@greole greole force-pushed the fix/failingDiagTest branch from 4519196 to 672f0b0 Compare May 12, 2026 06:39
@greole greole added build Everything related to building NF and removed build Everything related to building NF labels May 12, 2026
@chihtaw
Copy link
Copy Markdown
Collaborator

chihtaw commented May 12, 2026

It looks like the unit test added by this PR (exasim-project/NeoFOAM#275) only validates coefficient matrix of linear system of equations for pressure-velocity coupling on NeoFOAM side.

I think we need unit tests on NeoN side to validate the RHS of linear system of equations without pressure-velocity coupling which only happens on NeoFOAM.

@greole greole force-pushed the fix/failingDiagTest branch from 3d7a8f2 to 4118e8c Compare May 12, 2026 10:38
@greole greole added build Everything related to building NF and removed build Everything related to building NF labels May 12, 2026
Copy link
Copy Markdown
Collaborator

@chihtaw chihtaw left a comment

Choose a reason for hiding this comment

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

LGTM!
Just a comment on the documentation for removeBoundaryContributions.

Comment thread include/NeoN/linearAlgebra/linearSystem.hpp Outdated
Co-authored-by: Chih-Ta Wang <97195768+chihtaw@users.noreply.github.com>
@greole greole merged commit ae1c303 into develop May 13, 2026
19 of 21 checks passed
greole added a commit that referenced this pull request May 13, 2026
Add function to remove boundary contributions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Set this label to indicate that the PR is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants