Fix 3D boundary reaction flux recovery#404
Conversation
Recover pointwise traction from 3D rotated free-slip reactions by assembling a lumped triangular boundary mass and dividing nodal reactions by that mass. Support P1 traces directly and P2 traces through four-triangle facet subdivision, with global coordinate-based assembly for partition independence and a surface-mass-weighted mean gauge. Add serial and MPI regressions using the Zhong et al. l=2 internal-load shell. The corrected surface and CMB topography coefficients reproduce the reference response and remain invariant across MPI partitions. Retain focused 2D traction and flux coverage.
Adversarial review (public record) — strong core, but the P2 recovery has a structural defectThanks @gthyagi — the approach is right and most of it verifies beautifully. Full skeptic pass with live probes at np1/np2/np4 (PR branch merged onto current development, dedicated build): What HELD (verified live)
The blocker: P2 pointwise recovery is structurally wrong, and the Zhong test cannot see itOn a straight P2 triangle,
Asks before merge: (a) a consistent surface-mass solve on the P2 trace (M_boundary σ = R), or an explicit P1-only restriction with a clear raise; (b) a pointwise exact-flux box regression — P1 passes it today, P2 fails it today, and it's the test the harmonic fit can't substitute for; (c) docstring updates — Filed separately (pre-existing, exposed by the probes — not blockers here)
The core of this PR — P1 de-smear, global assembly, gauge — is exactly the missing 3D piece and worth landing promptly once the P2 story is honest. Underworld development team with AI support from Claude Code |
Replace the invalid four-subtriangle P2 lumping with the exact six-node triangular surface mass matrix and a sparse consistent solve. Add mass=auto so existing 2D and 3D P1 traces retain lumped recovery while 3D P2 selects the mathematically required consistent operator; reject explicit P2 lumping and unsupported 3D traces. Add pointwise constant-flux P1/P2 tetrahedral-box regressions in serial and MPI, including two- and four-rank partitions. Extend the Zhong l=2 validation to compare all nodes, vertices, and edge midpoints independently, removing the prior all-node cancellation blind spot. Document trace-order behavior, non-triangular limitations, analytic-normal partition guarantees, and the corrected 3D CBF behavior.
|
@lmoresi Thank you for the adversarial review. I reproduced the P2 vertex/midpoint defect and pushed Changes
Pointwise box regressionUnit-cube conduction, exact outward Bottom flux
The P2 assertion covers every vertex and edge midpoint. A separate regression verifies that explicit P2 lumping raises. Zhong degree-2 validation
The regression now checks all-node, vertex-only, and midpoint-only coefficients independently, so the previous node-count cancellation cannot pass. Serial, np=2, and np=4 results agree within Focused local validation:
Issues #407 and #408 remain separate as requested: the Zhong rotated-constraint reaction is not affected by #407, and this correctness patch retains the existing global topology reconciliation tracked by #408. |
Allow the serial and MPI Zhong l=2 rotated free-slip diagnostics to accept an optional shell cell size while retaining 0.25 as the regression-test default. Extend the standalone MPI diagnostic output with the selected cell size so manual convergence results are self-describing. This supports serial/MPI comparisons at 1/4, 1/8, and 1/16 resolution without adding costly high-resolution cases to routine CI.
|
@lmoresi Follow-up resolution sweep for the exact P2 surface-mass recovery in This is the no-self-gravity Zhong
Observations:
Validation after parameterization:
|
Adversarial re-review — round 2 (public record): the P2 fix is verified. Approving.@gthyagi — the consistent trace-mass rework is exactly right. Full round-2 findings: The round-1 defect is genuinely fixed
One genuine subtlety found — filed as #414, not a blockerOn CURVED boundaries the P2 vertex values converge only slowly: the vertex basis has zero surface mean, so vertex reactions carry only the O(h) facet-geometry error, and the (correct) consistent solve faithfully reconstructs that error. Measured on a spherical conduction probe: vertex error 93%→55% under one refinement while midpoints go 2.8%→0.7% (superconvergent). Your Zhong vertex-only fit drifts away from the reference with refinement (0.395→0.371) while the midpoint fit converges onto 0.419 — the wide test tolerances absorb this, which is fine, but consumers of pointwise σ_nn on curved boundaries should read midpoints or fitted quantities. A docstring caveat is the ask (#414). Housekeeping from the round
Merging. Thanks for the fast, correct turnaround — the four-subtriangle → consistent-mass pivot was exactly the right call. Underworld development team with AI support from Claude Code |
Delegate rotated free-slip traction recovery to the boundary-flux auto mass policy introduced by PR underworldcode#404. This selects the exact consistent surface-mass solve for 3D P2 traces while retaining lumped recovery where valid. Document the slower convergence of raw P2 vertex values on faceted curved boundaries and recommend fitted harmonic coefficients or midpoint samples for convergence studies.
Summary
Root cause
The previous 3D branch in
_desmear()returned the raw nodal reaction after subtracting its arithmetic mean. A finite-element nodal reaction is an integrated force, not a pointwise traction. The recovery must solveM_boundary * sigma_nn = Ror, for lumped mass,
sigma_nn[i] = R[i] / m_boundary[i].Without the surface-mass division, recovered 3D topography was mesh-dependent and nearly zero. The arithmetic mean also did not represent the surface integral gauge.
Implementation
For 3D triangular boundaries, the recovery now:
Unsupported 3D mass choices and element traces fail explicitly. The existing 2D implementation is unchanged.
Validation
Zhong et al. degree-2 isoviscous internal-load response,
ri=0.55,rint=0.775,ro=1.0, P2/P1:Focused checks:
This PR intentionally excludes the higher-level spherical-shell geoid and response postprocessing work. It contains only the boundary-flux correction and focused tests.
Context: #248