Files
MeanField/experiments/GRAVITY_PREPARED_ROUNDOFF_2026-09-17.md

5.3 KiB

Gravity prepared-residual arithmetic experiment

This hypothesis branch changes only the arithmetic assessment used after a gravity correction has passed its inner true-residual gate. It does not change that inner tolerance, the full-system lifted Newton gate, nonlinear merit acceptance, physical equations, or virial validation.

For fixed retained state, write the normalized gravity residual as G = A_q q + A_phi phi + b. Its norm can be tiny while the separate terms are large. Estimating arithmetic from ||G|| and the combined correction action therefore misses cancellation and the floating-point addition of corrected gravity coefficients.

Before changing the candidate, the workspace now measures the normalized gradient and potential actions separately, for both the old state and its correction. It infers the fixed source as b = G_old - A_q q - A_phi phi. Selection uses the compiled field block types, and applications reuse the prepared gravity operator. Scratch vectors are allocated with the workspace.

The assessment uses 256 epsilon times the sum of those five contribution norms and the norms of the old, desired, and freshly prepared gravity residuals. This is an explicit arithmetic estimate, not a rigorous forward-error bound: it does not bound cancellation inside each individual field action. The factor does not create an absolute residual floor, so a common scaling of the gravity equations scales the assessment equally.

Two separate requirements remain:

  1. The discrepancy between the affine prediction and freshly prepared gravity residual must fit the arithmetic estimate.
  2. The prepared residual's distance from its target must not exceed the measured inner true residual plus that estimate.

Diagnostics retain the raw affine discrepancy, raw target defect, arithmetic estimate, and resulting target threshold separately. Nonfinite or negative norm inputs fail the assessment. Each gravity attempt clears its correction norm and prepared-assessment measurements before the raw candidate preparation. An early preparation or inner-solve failure therefore leaves unmeasured values as NaN, rather than reusing the preceding attempt's values. Initial gravity completion follows the same rule. A failure in the corrected preparation can still retain that attempt's measured correction norm.

The last completed inner solve's true defect and cumulative solve/iteration/ failure/time counters have a different lifetime: a candidate that fails before calling the inner solver does not erase them. A line-search candidate rejected before invoking the gravity strategy does not begin an auxiliary attempt and leaves all last-attempt diagnostics intact. Diagnostic consumers must distinguish these meanings. Diagnostics also report whether compact gravity operator and inverse applications were selected.

lastLinearReportSpace labels the retained lastLinearSolve report from the outer strategy's Solve. A later positivity-direction relift can fail while that outer report remains converged in reduced coordinates. The evaluation then reports linear_solve_failure; the auxiliary failure is reflected by the gravity failure counter and last completed inner true defect. Changing only the report space would incorrectly relabel the retained reduced-system norms. The full lifted Newton gate precedes feasibility repair; a repaired direction must pass its relift, descent check, and nonlinear acceptance, but is not claimed to solve the original Newton equations.

Three focused tests, appended to tests/solver/gravity_reduction.cpp, cover large cancelling contributions, rejection of defects beyond either gate, nonfinite measurements, and scaling over twenty-four orders of magnitude. All three passed with 28 assertions in serial and 28 assertions per rank on two ranks. The subsequent production n=1, J=0 curvature control converged and passed all eight virial checks, with no prepared-consistency failure. The n=1.5, J=0 curvature run likewise had no prepared-consistency failures: all 14 auxiliary gravity solves passed, but the outer linear iteration cap stopped the model before nonlinear convergence. These runs reassess the original auxiliary rejection; the synthetic arithmetic tests alone do not establish stellar convergence or validate the estimate as a rigorous error bound.

Reporting regression

Branch research/gravity-trial-diagnostics-20260917 moves this reset to a shared attempt-entry helper, used by both trial strategies and initial completion. Existing production rollback fixtures now assert finite measurements after a completed curvature assessment, and unavailable prepared/correction fields after a failed initial inner solve while retaining its finite true defect and counters. No new stellar fixture or numerical behavior is introduced. The source-level success-then-early-failure path is covered by the unconditional shared reset; a separate expensive campaign is not justified for this reporting change. The final c82e68d build passes the targeted serial suite: 43 cases and 1,886 assertions, including these added checks. The supported two-rank suite passes 37 cases per rank (1,108 / 949 assertions). Full stellar MPI fixtures retain their existing one-rank interpolation restriction. Immutable final build/test evidence is in tests_v4 of the numerical-strategies campaign.