Repository navigation
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.
Issues in this branch's territoryTerritory is
#408 is narrowed, not closedThis PR does not change So for Nusselt/heat-flow diagnostics — which is what #408 was measured on — the Underworld development team with AI support from Claude Code |
lmoresi
left a comment
There was a problem hiding this comment.
Approved. The partition-of-unity argument for summing consistent nodal reactions is sound, the shared-point participation is handled, and tests/parallel/test_1065_boundary_flux_parallel.py covers the collective. Adjudication above: this narrows #408 for integral diagnostics without closing it.
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.