Add MPI-complete direct scalar boundary-flux integrals - #709
Open
gthyagi wants to merge 1 commit into
Open
Conversation
…ions Expose boundary_flux_integral() as a collective raw scalar CBF reaction sum. Propagate boundary membership across the PETSc point SF before summing, so partial nodal reactions are retained on ranks without a labelled local boundary facet. Avoid pointwise recovery and temporary flux fields. Document sign, normalization, essential-boundary and corner constraints. Include exact signed P1/P2 triangle/tetrahedron tests and existing smooth-flux references. The clean upstream-based build passes 20 serial tests and nine tests on eight MPI ranks. No unrelated mantle solver changes are included.
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.
Purpose
Add a collective scalar diagnostic:
For integral quantities such as heat-flow/Nusselt diagnostics, recover the
integral directly from consistent nodal reactions rather than create a
pointwise flux field, recover its boundary mass, and integrate that field
again. The public solver method delegates to
utilities.boundary_flux.Mathematics and MPI
For an essential boundary whose trace basis forms a partition of unity,
summing its consistent nodal reactions gives the integrated CBF flux. Each
rank's volume assembly contains partial reactions, so all contributing
copies of a shared boundary point must participate exactly once.
The original mantle feature (
6177be86) only selected points from locallylabelled facets. New tests exposed missing contributions when a rank shared
a boundary point but held no labelled boundary facet. This revision first
reduces boundary-membership flags to point owners and broadcasts them back
through the PETSc point SF, then reduces the local reaction sums. It does
not replicate global boundary coordinates or construct a flux MeshVariable.
All corrected Top integrals are +2.5. Assertions use absolute tolerance
1e-8, unchanged after the MPI fix. The existing nonuniform smooth-fluxserial/parallel reference is retained as an additional check.
Contract and Limitations
essential boundary. Vector fields are rejected before reaction assembly.
boundary_flux().by the relevant area and reference conductive flux when required.
contributions; this is not a facet-separated integral at those corners.
Validation
Clean branch built from
developmentat87091138in an isolated installusing the existing Pixi dependencies; no other mantle changes are present.
New exact tests cover P1/P2 triangles/tetrahedra, signed conservation,
unchanged mesh-variable registration, unknown boundaries and vector
rejection. No long coupled convection run is used as a correctness test.
@lmoresi please review the direct-reaction integral contract, especially the
point-SF membership propagation and the documented shared-corner limitation.