Skip to content

Add computeDivProcBoundImpl and computeLaplacianProcBoundImpl for pro…#512

Merged
greole merged 12 commits into
developfrom
enh/procOperatorImpl
May 26, 2026
Merged

Add computeDivProcBoundImpl and computeLaplacianProcBoundImpl for pro…#512
greole merged 12 commits into
developfrom
enh/procOperatorImpl

Conversation

@greole
Copy link
Copy Markdown
Contributor

@greole greole commented May 20, 2026

Implements matrix-coefficient assembly at processor-boundary faces for both the Gauss-Green divergence and Laplacian operators and tests it against non distributed counterparts. This is also taken from #414 and currently misses the distributed solver test.

@github-actions
Copy link
Copy Markdown

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

@greole greole force-pushed the enh/procOperatorImpl branch 3 times, most recently from 501303f to e5df305 Compare May 22, 2026 07:39
Comment thread include/NeoN/finiteVolume/cellCentred/operators/gaussGreenDiv.hpp Outdated
Comment thread include/NeoN/finiteVolume/cellCentred/operators/gaussGreenLaplacian.hpp Outdated
Comment thread include/NeoN/linearAlgebra/faceToMatrixAddress.hpp Outdated
Comment thread src/finiteVolume/cellCentred/operators/gaussGreenDiv.cpp Outdated
@greole greole force-pushed the enh/procOperatorImpl branch 3 times, most recently from be20a4c to 2d52a75 Compare May 22, 2026 14:47
Comment thread src/finiteVolume/cellCentred/operators/gaussGreenLaplacian.cpp
Comment thread src/finiteVolume/cellCentred/operators/gaussGreenLaplacian.cpp Outdated
Comment thread src/linearAlgebra/faceToMatrixAddress.cpp Outdated
Comment thread test/linearAlgebra/cooSparsityPattern.cpp
Comment thread test/linearAlgebra/linearSystem.cpp
@greole greole force-pushed the enh/procOperatorImpl branch from 2d52a75 to 9a98d27 Compare May 22, 2026 16:58
@greole greole marked this pull request as ready for review May 22, 2026 17:05
…cessor boundaries

Implements matrix-coefficient assembly at processor-boundary faces for both
the Gauss-Green divergence and Laplacian operators. Includes the required
LinearSystem::nonLocalMatrix() member and FaceToMatrixAddress extensions that
track local/nonLocal/boundary sparsity patterns and row counts.
@greole greole force-pushed the enh/procOperatorImpl branch from b6f90b2 to 142b691 Compare May 23, 2026 14:56
Comment thread src/finiteVolume/cellCentred/stencil/basicGeometryScheme.cpp Outdated
@greole greole force-pushed the enh/procOperatorImpl branch from a25feaa to f7221a8 Compare May 23, 2026 18:56
@greole greole added the ready-for-review Set this label to indicate that the PR is ready for review label May 23, 2026
@greole greole requested a review from Copilot May 23, 2026 19:02
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 extends NeoN’s finite-volume implicit operator assembly to properly handle processor-boundary (inter-rank) faces for Gauss-Green divergence and Laplacian, storing cross-rank coefficients separately and adding MPI unit tests to validate equivalence with the non-distributed assembly.

Changes:

  • Add implicit proc-boundary coefficient assembly for div and laplacian, storing non-local contributions in a new LinearSystem::offDiagonalMatrix().
  • Extend geometry handling to compute/exchange proc-boundary distances used in non-orthogonal delta coefficients.
  • Add a new MPI unit test (test/distributed/operator.cpp) and wire it into the distributed test CMake.

Reviewed changes

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

Show a summary per file
File Description
test/linearAlgebra/utilities.cpp Updates test setup to provide a dedicated boundary RHS vector.
test/linearAlgebra/linearSystem.cpp Refactors test variable naming/usage around LinearSystem construction and host copying.
test/linearAlgebra/faceToMatrixAddress.cpp Minor rename/cleanup in sparsity pattern test.
test/distributed/operator.cpp New MPI test validating distributed operator assembly (main + off-diagonal parts) against global assembly.
test/distributed/CMakeLists.txt Registers the new distributed operator test when MPI is enabled.
src/mesh/unstructured/unstructuredMesh.cpp Minor cleanup in uniform mesh creation implementation.
src/linearAlgebra/ginkgo.cpp Silences unused-parameter warnings for an unsupported COO(Vec3) overload.
src/linearAlgebra/faceToMatrixAddress.cpp Moves FaceToMatrixAddress methods out-of-header; adds proc-boundary sparsity helper (currently TODO).
src/finiteVolume/cellCentred/stencil/cellToFaceStencil.cpp Minor cleanup removing unused view extraction.
src/finiteVolume/cellCentred/stencil/basicGeometryScheme.cpp Adds MPI exchange to compute proc-boundary neighbour distances for non-orth delta coeffs.
src/finiteVolume/cellCentred/operators/gaussGreenLaplacian.cpp Adds computeLaplacianProcBoundImpl and integrates it into implicit Laplacian assembly.
src/finiteVolume/cellCentred/operators/gaussGreenDiv.cpp Adds computeDivProcBoundImpl and integrates it into implicit divergence assembly.
src/finiteVolume/cellCentred/interpolation/upwind.cpp Extends upwind weights to proc-boundary faces.
include/NeoN/mesh/unstructured/unstructuredMesh.hpp Reorders/clarifies nProcBoundaryFaces() API with documentation.
include/NeoN/linearAlgebra/matrix.hpp Adds a placeholder Matrix::reset() API (currently no-op).
include/NeoN/linearAlgebra/linearSystem.hpp Adds offDiagonalMatrix_ storage and constructors; resets it in LinearSystem::reset().
include/NeoN/linearAlgebra/faceToMatrixAddress.hpp Moves inline implementations to .cpp.
include/NeoN/finiteVolume/cellCentred/operators/gaussGreenLaplacian.hpp Header cleanup (removes declarations/extern templates).
include/NeoN/finiteVolume/cellCentred/operators/gaussGreenDiv.hpp Header cleanup (removes extern templates).
include/NeoN/finiteVolume/cellCentred/faceNormalGradient/faceNormalGradient.hpp Silences unused-parameter warnings in default implicitCorrection.
include/NeoN/distributed/partitioning.hpp Populates proc-boundary boundary values when partitioning 1D fields.

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

Comment thread include/NeoN/linearAlgebra/matrix.hpp Outdated
Comment on lines 147 to 156
[[nodiscard]] LinearSystem<ValueType, SystemMatrixType, BoundaryMatrixType>
copyToExecutor(Executor exec) const override
{
return {
matrix_.copyToExecutor(exec),
rhs_.copyToExecutor(exec),
boundaryMatrix_.copyToExecutor(exec),
boundaryRhs_.copyToExecutor(exec)
boundaryRhs_.copyToExecutor(exec),
offDiagonalMatrix_.copyToExecutor(exec)
};
Comment on lines +37 to +38
float epsilon = 1e-32;

Comment thread test/distributed/operator.cpp Outdated
Comment on lines +160 to +165
auto solverStats = solver.solve(ls, x);
auto solverStatsDist = solver.solve(lsDst, xPart);

auto [numIterDist, initResNormDist, finalResNormDist, solveTimeDist] =
solverStatsDist.entries[0];
auto [numIter, initResNorm, finalResNorm, solveTime] = solverStats.entries[0];
Comment thread include/NeoN/linearAlgebra/linearSystem.hpp Outdated
Copy link
Copy Markdown
Collaborator

@lupeterm lupeterm left a comment

Choose a reason for hiding this comment

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

LGTM

@greole greole force-pushed the enh/procOperatorImpl branch from 0d5dd9e to a3a0153 Compare May 26, 2026 17:09
greole and others added 3 commits May 26, 2026 20:27
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@greole greole added auto-fix and removed auto-fix labels May 26, 2026
@greole greole merged commit 6d3810f into develop May 26, 2026
20 of 21 checks passed
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